Tutorialsplane

Capitalize first letter of string in JavaScript


Capitalize first letter of string in JavaScript – It is quite easy and simple to capitalize the first letter of string in Javascript. You can use toUpperCase() function to capitalize the first letter of the string. Here in this tutorial we are going to explain how to capitalize the first letter of the given string using the predefined toUpperCase() function. You can use our online editor to try & edit the example code & see output.


How to Capitalize first letter of string in JavaScript?

Capitalize first letter of string in JavaScript Example:


Try it »

The above function will accept the string and will format it into capitalize form. You can use this function anywhere to capitalize the string. Just pass the string it will return the capitalized string. If you run the above example it will produce the output something like this –