Returns a capitalised version of the string - Node.js String

Node.js examples for String:Case

Description

Returns a capitalised version of the string

Demo Code


/**//  w w w  . j  av  a2 s  . c  om
 * returns a capitalised version of the string
 *
 * @return String captialised version
 */
capitalize: function() {
  return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
},

Related Tutorials