FrontendDeveloper.in

JavaScript question detail

How do you make first letter of the string in an uppercase

You can create a function which uses a chain of string methods such as charAt, toUpperCase and slice methods to generate a string with the first letter in uppercase.

function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399