JS Coding Questions Logo
JS Coding Questions
#130💼 Interview💻 Code

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

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 Coding

Advertisement

728x90
130of476
How do you make first letter of the string in an uppercase | JSCodingQuestions.com