It is so easy to capitalize the first word of a string in Javascript. The following Javascript function will change the first word of a string to capitalize. function titleCase(string) { return string.charAt(0).toUpperCase() + string.slice(1); }. Full Source Code.