make random letter capital in string javascript

Solutions on MaxInterview for make random letter capital in string javascript by the best coders in the world

showing results for - "make random letter capital in string javascript"
Clementine
15 Jun 2018
1var string = "freeCodecamp";
2
3function capitalizeFirstLetter(str) {
4  return str.charAt(0).toUpperCase() + str.slice(1);
5}
6
7capitalizeFirstLetter(string); // Returns "FreeCodecamp"