jamesboy27 Posted November 17, 2013 Posted November 17, 2013 I'm a beginning Javascripter and was wondering why this is happening?
liverare Posted November 17, 2013 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
Cyro Posted November 17, 2013 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
Swizzbeat Posted November 17, 2013 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
harrynoob Posted November 17, 2013 Posted November 17, 2013 your ) is misplaced, the line should be console.log(myCountry.length);
Credskiz Posted November 26, 2013 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 ")"