1function isUpper(str) {
2 return !/[a-z]/.test(str) && /[A-Z]/.test(str);
3}
4
5isUpper("FOO"); //true
6isUpper("bar"); //false
7isUpper("123"); //false
8isUpper("123a"); //false
9isUpper("123A"); //true
10isUpper("A123"); //true
11isUpper(""); //false
12
1/**** Check if First Letter Is Upper Case in JavaScript***/
2function startsWithCapital(word){
3 return word.charAt(0) === word.charAt(0).toUpperCase()
4}
5
6console.log(startsWithCapital("Hello")) // true
7console.log(startsWithCapital("hello")) // false
1function startsWithCapital(word){
2 return word.charAt(0) === word.charAt(0).toUpperCase()
3}