Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to check if the first letter of a string is capitalized or uppercase in js

/**** Check if First Letter Is Upper Case in JavaScript***/
function startsWithCapital(word){
    return word.charAt(0) === word.charAt(0).toUpperCase()
}

console.log(startsWithCapital("Hello")) // true
console.log(startsWithCapital("hello")) // false
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #letter #string #capitalized #uppercase #js
ADD COMMENT
Topic
Name
1+3 =