Skip to content

Instantly share code, notes, and snippets.

@masautt
Created September 6, 2019 03:57
Show Gist options
  • Select an option

  • Save masautt/bb551be4a59ef8080534cc91ca4785b8 to your computer and use it in GitHub Desktop.

Select an option

Save masautt/bb551be4a59ef8080534cc91ca4785b8 to your computer and use it in GitHub Desktop.
How to check if string is all uppercase in JavaScript?
function isUpperCase(str) {
return str === str.toUpperCase();
}
let fname = "Marek";
let lname = "SAUTTER";
console.log(isUpperCase(fname)); // --> false
console.log(isUpperCase(lname)); // --> true
// https://stackoverflow.com/questions/17572873/how-can-i-check-if-a-string-is-all-uppercase-in-javascript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment