The browser storage localStorage is not available. Either your browser does not support it or you have disabled it or the maximum memory size is exceeded. Without localStorage your solutions will not be stored.
Strings have the
lengthproperty. This property represents the number of characters in a string. To do this, you must append
.lengthto the string or to the variable that contains the string:
let charNumber = 'Ai'.length;
'Ai'has 2 characters. So
charNumberhas the value
let name = 'Weiwei'; charNumber = name.length;
'Weiwei'has 6 characters.
charNumbernow has the value
The empty string has no characters. The value of
charNumber = ''.length;
Write a function
lengththat takes a string and returns the number of characters of the string.