[フレーム]
Last Updated: February 25, 2016
·
558
· tmaster

Capitalize strings in JavaScript.

String.prototype.capitalize = function() {
 return this.charAt(0).toUpperCase() + this.slice(1);
};

var myString = 'abc';
console.log(myString.capitalize()); // output is 'Abc'

AltStyle によって変換されたページ (->オリジナル) /