We can convert the first letter of the word to uppercase by using chatAt and slice methods as follows.
let word = "hello";
console.log(word.charAt(0).toUpperCase() + word.slice(1));
Output: Hello
Here, charAt(0).toUpperCase will convert the first letter of the word to uppercase and word.slice(1) will return the remaining characters of the word except first letter.
Discover more from Learners Store
Subscribe to get the latest posts sent to your email.