Проверьте, является ли буква upercare javaScript
const isUpperCase = (string) => /^[A-Z]*$/.test(string)
ammer
const isUpperCase = (string) => /^[A-Z]*$/.test(string)
function isUpper(str) {
return !/[a-z]/.test(str) && /[A-Z]/.test(str);
}
isUpper("FOO"); //true
isUpper("bar"); //false
isUpper("123"); //false
isUpper("123a"); //false
isUpper("123A"); //true
isUpper("A123"); //true
isUpper(""); //false
var word = 'apple' //Expected: false
//Use word[0] to grap the first letter
if (word[0] == word[0].toUpperCase()) {
//Word is uppercase
} else {
//Word is not uppercase
}
var strings = 'this iS a TeSt 523 Now!';
var i=0;
var character='';
while (i <= strings.length){
character = strings.charAt(i);
if (!isNaN(character * 1)){
alert('character is numeric');
}else{
if (character == character.toUpperCase()) {
alert ('upper case true');
}
if (character == character.toLowerCase()){
alert ('lower case true');
}
}
i++;
}
isUpperCase('A') // true
isUpperCase('a') // false
var str = S;
if (str == str.toUpperCase())
{
console.log(" Uppercase");
}
else
{
console.log("Lowercase");
}