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
1var word = 'apple' //Expected: false
2
3//Use word[0] to grap the first letter
4if (word[0] == word[0].toUpperCase()) {
5 //Word is uppercase
6} else {
7 //Word is not uppercase
8}
1var strings = 'this iS a TeSt 523 Now!';
2var i=0;
3var character='';
4while (i <= strings.length){
5 character = strings.charAt(i);
6 if (!isNaN(character * 1)){
7 alert('character is numeric');
8 }else{
9 if (character == character.toUpperCase()) {
10 alert ('upper case true');
11 }
12 if (character == character.toLowerCase()){
13 alert ('lower case true');
14 }
15 }
16 i++;
17}
18