Capitalize The First Letter Of String In JavaScript

For More Videos Visit Our YouTube Channel




Here we consider how to capitalize the first letter of a string in JavaScript Lets start with one example here. Suppose we have a string variable inside javascript.

var stringVariable = "mystring";



We can find the character and Capitalize the string as shown here.

var stringVariable = stringVariable.charAt(0).
toUpperCase() + stringVariable.slice(1);



By this way we can capitalize the first letter of string in JavaScript.