Skip to content

Instantly share code, notes, and snippets.

@iamsalnikov
Created December 6, 2013 13:59
Show Gist options
  • Save iamsalnikov/7824234 to your computer and use it in GitHub Desktop.
Save iamsalnikov/7824234 to your computer and use it in GitHub Desktop.
Javascript capitalize string
/**
* Capitalize string
* Example of usage: "hello world".capitalize(); // Hello world
*/
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment