December 2013
Intermediate to advanced
384 pages
9h 54m
English
var s = "One Ring"; s.length; //returns 8 var s2 = "To Rule\nThem All"; s2.length; //returns 16 because \n is only 1 character
String objects have a length attribute that contains the number of characters in the string. This includes the number of special characters as well, such as \t and \n. To get the length of the string, simply use the .length attribute on the string object.
Read now
Unlock full access