Skip to main content

Check if a string contains upper case characters

JavaScript version

const containsUpperCase = (str) => str !== str.toLowerCase();

TypeScript version

const containsUpperCase = (str: string): boolean => str !== str.toLowerCase();

Examples

containsUpperCase('Hello World'); // true
containsUpperCase('hello world'); // false

Comments