Answers for "js string check case"

1

js string check case

//Some characters like numbers or punctuation also return true 
//when checked for lowercase/uppercase.
//The solve is the second part
//I found this to work very well for it:
function isLowerCase(str)
{
    return str == str.toLowerCase() && str != str.toUpperCase();
}
console.log(isLowerCase("a")); //expected true
console.log(isLowerCase("A")); //expected false
console.log(isLowerCase("Ü")); //expected false
console.log(isLowerCase("4")); //expected false
console.log(isLowerCase("_")); //expected false
Posted by: Guest on August-20-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language