Add a function like Python's capitalize to JavaScript strings. - Node.js String

Node.js examples for String:Case

Description

Add a function like Python's capitalize to JavaScript strings.

Demo Code


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

Related Tutorials