Make Every First Letter Uppercase of a sentence (JavaScript)



Function Declaration : 

function CapitaliseFirstLetter(string)
{
var result = string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
return result;
}

Function Call : 

var sResult = CapitaliseFirstLetter(“javascript is awesome.”);

alert(sResult);

OUTPUT : Javascript Is Awesome.

Leave a Reply