[Home] > Snippets  > Languages  > JavaScript  > Validation  >  Check if a string is upper case

Check if a string is upper case

JavaScript

const isUpperCase = (str) => str === str.toUpperCase()

TypeScript

const isUpperCase = (str: string): boolean => str === str.toUpperCase()