Capitalizing The First Letter In a String

Bryam Vicente
Jul 6, 2021

For this blog I’ll be going over a simple problem in which we have to capitalize the first letter in a string. Here’s a picture of the prompt:

The prompt is asking us to create a function that takes in a string and can capitalize the first letter in the string. There are multiple ways in which we can solve this problem. I chose to solve this problem by creating an array and pushing the characters in a string inside the new array! Here’s the full solution:

Please feel free to reach out if there are better methods to solve this problem! For more info on .toUpperCase(), .slice(), .split(), and .join() check out the resource section below.

Resource:

--

--