Advertisement
728x90
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.
javascript
1function capitalizeFirstLetter(string) {
2 return string.charAt(0).toUpperCase() + string.slice(1);
3 }Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 46
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
130of476