showing results for - "js string check case"
Nicolò
21 Apr 2017
1//Some characters like numbers or punctuation also return true 
2//when checked for lowercase/uppercase.
3//The solve is the second part
4//I found this to work very well for it:
5function isLowerCase(str)
6{
7    return str == str.toLowerCase() && str != str.toUpperCase();
8}
9console.log(isLowerCase("a")); //expected true
10console.log(isLowerCase("A")); //expected false
11console.log(isLowerCase("Ü")); //expected false
12console.log(isLowerCase("4")); //expected false
13console.log(isLowerCase("_")); //expected false
14