I\'m trying to proper case a string in javascript - so far I have this code: This doesn\'t seem to capitalize the first letter, and I\'m also stuck on how to lowercase all the l
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
}
This function uppercases 1st letter and lowercases the rest part od the string.
A bit changed function from the perfect answer found here: How do I make the first letter of a string uppercase in JavaScript?