To capitalize the first letter in JavaScript, do this:
string.charAt(0).toUpperCase() + string.substring(1)
.Here's how you do it:
const string = 'hello world!';
const capitalized = string.charAt(0).toUpperCase() + string.substring(1);
console.log(capitalized); // Hello world!