Nodejs String to Upper Case upcase()

Here you can find the source of upcase()

Method Source Code

String.prototype.upcase = function () {
  return this.valueOf().toUpperCase();
};

Related

  1. ucwords()
    String.prototype.ucwords = function () {
      var words = this.split(' ');
      for (var i = 0; i < words.length; i++)
        words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1);
      return words.join(' ');
    };
    module.exports = function () {
    };
    
  2. ucwords()
    String.prototype.ucwords = function(){
      var arr = this.split(' ');
      var str ='';
      arr.forEach(function(v){
        str += v.charAt(0).toUpperCase()+v.slice(1,v.length)+' ';
      });
      return str;
    };
    
  3. ucwords()
    String.prototype.ucwords = function(){
      return this.replace(/(?:^|\s)\S/g,function(v){return v.toUpperCase();});
    };
    
  4. ucwords()
    String.prototype.ucwords = function () {
      return this.toLowerCase().replace(/^.|\s\S/g, function (a) {
        return a.toUpperCase();
      });
    };
    
  5. upWord()
    String.prototype.upWord = function (){
      var words = this.split(" ");
      var newWords = words.map(function(elem,index) {
        return (elem[0].toUpperCase() + elem.slice(1));
      })
      return newWords.join(" ");
    var str = "the quick fox jump over the lazy dog";
    console.log(str.upWord());
    ...
    
  6. upcase()
    String.prototype.upcase = function(){
        return this.toUpperCase();
    };
    
  7. upperCaseFirst()
    String.prototype.upperCaseFirst = function() {
      return this.replace(/^./, function(a) {
        return a.toUpperCase();
      });
    };
    
  8. upperFirstChar()
    String.prototype.upperFirstChar = function() {
      return this.charAt(0).toUpperCase() + this.slice(1)
    
  9. upperFirstLetter()
    String.prototype.upperFirstLetter = function() {
        return this.charAt(0).toUpperCase() + this.slice(1);