check if string contains lowercase javascript code example
Example 1: js if text contains lowercase
function hasLowerCase(str) {
return str.toUpperCase() != str;
}
console.log("HeLLO: ", hasLowerCase("HeLLO"));
console.log("HELLO: ", hasLowerCase("HELLO"));
Example 2: check if string contains lowercase javascript
// A minified version of the other one:
const hasLowerCase= s => s.toUpperCase() != s;
console.log("HeLLO: ", hasLowerCase("HeLLO"));
console.log("HELLO: ", hasLowerCase("HELLO"));