0

How the answer is 3?

var len = 0; for(let ch of "Solo"){ if(ch>'a' && ch<'z') len++ ;} console.log(len); //Ans : 3

16th Jan 2023, 4:39 PM
Mohammad Tausiful Alam
Mohammad Tausiful Alam - avatar
3 Answers
+ 3
The S is is capital, and does not fall in the range between lowercase “a” and “z”. Therefor only 3 characters meet the condition and increase you len counter.
16th Jan 2023, 5:57 PM
Edilson Espinosa
Edilson Espinosa - avatar
+ 4
There are 3 letters between 'a' and 'z' in the string: o, l, o
16th Jan 2023, 5:37 PM
Lisa
Lisa - avatar
+ 1
Got it. thanks
16th Jan 2023, 6:35 PM
Mohammad Tausiful Alam
Mohammad Tausiful Alam - avatar