Nodejs String Capitalize capitalize()

Here you can find the source of capitalize()

Method Source Code

// Capitalize the first letter of the string
String.prototype.capitalize = function () {
  return this.charAt(0).toUpperCase() + this.slice(1);
}

Related

  1. capitalize()
    String.prototype.capitalize = function() {
      return this[0].toUpperCase() + this.slice(1);
    
  2. capitalize()
    String.prototype.capitalize = function () {
      return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase();
    
  3. capitalize()
    String.prototype.capitalize = function() {
      return this.slice(0, 1).toUpperCase() + this.slice(1).toLowerCase();
    };
    
  4. capitalize()
    String.prototype.capitalize = function () {
        'use strict';
        return this.charAt(0).toUpperCase() + this.slice(1);
    };
    
  5. capitalize()
    String.prototype.capitalize = function () {
      return this.charAt(0).toUpperCase() + this.slice(1);
    
  6. capitalize()
    String.prototype.capitalize = function () {
      return this ? this.charAt(0).toUpperCase() + this.slice(1) : '';
    };
    
  7. capitalize()
    String.prototype.capitalize = function() {
      var str = this
      return str.charAt(0).toUpperCase() + str.slice(1);
    
  8. capitalize()
    String.prototype.capitalize = function() {
      return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
    };
    
  9. capitalize()
    String.prototype.capitalize = function() {
      return this.charAt(0).toUpperCase() + this.slice(1);
    export default {};