+ 2

How to understand

var a = "var a".length; alert(5) Output result 5

24th Feb 2019, 8:40 AM
Ariful
Ariful - avatar
5 Answers
+ 4
If you alert 5, it will output 5, it is simple. To first line, a equals length of string "var a" which is 5.
24th Feb 2019, 9:03 AM
Maneren
Maneren - avatar
+ 2
Can you explain better your problem? Its not clear what you asking. Futhermore you use tags in wrong way
24th Feb 2019, 8:42 AM
KrOW
KrOW - avatar
+ 1
i understand but how to cound other string ex var a = "var adsdf".length; what is output?
24th Feb 2019, 9:09 AM
Ariful
Ariful - avatar
+ 1
Arif The output is the character count which the string is builded up... "SoloLearn".length= 9 "Solo Learn".length= 10 "".length= 0
24th Feb 2019, 9:11 AM
KrOW
KrOW - avatar
+ 1
ohhh okkk i understan. it cound string letter . i don’t count space position .. thank bosss
24th Feb 2019, 9:16 AM
Ariful
Ariful - avatar