Skip to content

Instantly share code, notes, and snippets.

@eshacker
Last active December 19, 2015 14:25
Show Gist options
  • Select an option

  • Save eshacker/ebe19509c054852b3262 to your computer and use it in GitHub Desktop.

Select an option

Save eshacker/ebe19509c054852b3262 to your computer and use it in GitHub Desktop.
Title Casing A Normal String
var str = "the quick brown fox jumped over the lazy dog";
var arr = str.split(' ');
var titleArr = arr.map(function(x){
return x.charAt(0).toUpperCase() + x.slice(1);
});
var titleStr = titleArr.join(' ');
console.log(titleStr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment