Skip to content

Instantly share code, notes, and snippets.

@masautt
Created September 6, 2019 03:58
Show Gist options
  • Save masautt/c7146f1f5daad173418ef871bc5343e8 to your computer and use it in GitHub Desktop.
Save masautt/c7146f1f5daad173418ef871bc5343e8 to your computer and use it in GitHub Desktop.
How to check if string is all lowercase in JavaScript?
function isLowerCase(str) {
return str === str.toLowerCase();
}
let fname = "Marek";
let lname = "sautter";
console.log(isLowerCase(fname)); // --> false
console.log(isLowerCase(lname)); // --> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment