String.prototype.charAt()
= > Get first character of string using charAt[0] method.
String.prototype.toUpperCase()
=> Use toUpperCase()
to capitalize first letter of string that is returned by charAt
method
'somestring'.charAt(0).toUpperCase() + 'somestring'.slice(1)
Here is the simple function that you can use multiple times
function capitalize(string) {
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
}