Check if first letter of word is a capital letter

update

Updating with what i think is the most valid approach nowadays.

You can use a Unicode property escapes Regular expression if the support suits you. In this case you can use the General category property for Uppercase Letter Lu.

function isUppercase(word){
  return /^\p{Lu}/u.test( word );
}

older answers

var word = "Someword";
console.log( word[0] === word[0].toUpperCase() );

or

var word = "Someword";
console.log( /[A-Z]/.test( word[0]) );

or

var word = "Someword";
console.log( /^[A-Z]/.test( word) );

See toUpperCase() and test()

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)