jamesboy27 Posted November 17, 2013 Share Posted November 17, 2013 I'm a beginning Javascripter and was wondering why this is happening? Link to comment Share on other sites More sharing options...
liverare Posted November 17, 2013 Share Posted November 17, 2013 (edited) I'm clueless in JavaScript, so I'm guessing: "Amerifat" is not a String type, thus; you can't return its length. I say this because, in Java, you define a String by String, not var. length; is not the correct way of returning the String's length. I say this because, in Java; you get the String's length with length(); Edited November 17, 2013 by liverare Link to comment Share on other sites More sharing options...
Cyro Posted November 17, 2013 Share Posted November 17, 2013 i dont do JavaScript, but from what i know i would guess that #log() is a void or another type of method just like println() in Java and that should be ... console.log(myCountry.length); console.log(myCountry.substring(0,3)); ... 1 Link to comment Share on other sites More sharing options...
Swizzbeat Posted November 17, 2013 Share Posted November 17, 2013 (edited) I think you have to make a new variable first for the length, and then log it. Something like: var l = MyCountry.length; Haven't done JavaScript in awhile so don't quote me on this. Edited November 17, 2013 by Swizzbeat Link to comment Share on other sites More sharing options...
harrynoob Posted November 17, 2013 Share Posted November 17, 2013 your ) is misplaced, the line should be console.log(myCountry.length); Link to comment Share on other sites More sharing options...
Credskiz Posted November 26, 2013 Share Posted November 26, 2013 i dont do JavaScript, but from what i know i would guess that #log() is a void or another type of method just like println() in Java and that should be ... console.log(myCountry.length); console.log(myCountry.substring(0,3)); ... This one's correct, you've misplaced the ")" Link to comment Share on other sites More sharing options...