Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check if letter is uppercase javascript

const isUpperCase = (string) => /^[A-Z]*$/.test(string)
Comment

javascript check if all capital letter

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
Comment

check to see if work is uppercase javascript

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
}
Comment

check if letter is uppercase javascript

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++;
}
Comment

check if letter is uppercase javascript

isUpperCase('A') // true
isUpperCase('a') // false
Comment

how to check if a letter is capital in javascript

// program to convert first letter of a string to uppercase
function capitalizeFirstLetter(str) {

    // converting first letter to uppercase
    const capitalized = str.charAt(0).toUpperCase() + str.slice(1);

    return capitalized;
}

// take input
const string = prompt('Enter a string: ');

const result = capitalizeFirstLetter(string);

console.log(result);
Comment

PREVIOUS NEXT
Code Example
Javascript :: useeffect clearinterval loading 
Javascript :: react hook form with yup resolver 
Javascript :: .ajax how to get data from form 
Javascript :: number constructor js 
Javascript :: select text with javascript 
Javascript :: detect logged user wordpress javascript 
Javascript :: firestore javascript delete document 
Javascript :: readfile nodejs 
Javascript :: jquery active menu 
Javascript :: js  
Javascript :: for of loop javascript 
Javascript :: not getting any response with fetch javascript method 
Javascript :: show tooltip automatically 
Javascript :: javascript array 
Javascript :: history push search params 
Javascript :: copy one array to another javascript 
Javascript :: object deep copy 
Javascript :: react forms 
Javascript :: javascript enum 
Javascript :: how to autoload config files added in composer.json laravel 
Javascript :: javascript long integer 
Javascript :: does filter mutate array 
Javascript :: javascript change color of text input 
Javascript :: bootstrap datepicker mindate and maxdate 
Javascript :: display content in a modal react 
Javascript :: nodejs buffer.from base64 
Javascript :: how to limit characters in number input js 
Javascript :: confirm javascript 
Javascript :: javascript urlsearchparams to string 
Javascript :: react router active link 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =