0 votes
in JavaScript by
How do you make first letter of the string in an uppercase in Javascript?

1 Answer

0 votes
by

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.

function capitalizeFirstLetter(string) {
  return string.charAt(0).toUpperCase() + string.slice(1);
}

Related questions

0 votes
asked Oct 7, 2023 in JavaScript by GeorgeBell
0 votes
asked Oct 21, 2023 in JavaScript by DavidAnderson
...