Nodejs String Sub String from Left left(num)

Here you can find the source of left(num)

Method Source Code

String.prototype.left = function(num) {
   var result = '';
   for (var i = 0; i < num; i++) {
      result += this[i];//from  w w  w .  j a va2 s. c o  m
   };
   return result;
}

Related

  1. left(count)
    String.prototype.left = function(count) {
        if (count > this.length) return this.toString();
        return this.substring(0, count);
    };
    
  2. left(i)
    String.prototype.left = function(i)
        if (this.length > i) return this.substr(0, i) + "...";
        return this;
    };
    
  3. left(n)
    String.prototype.left = function(n) {
      return this.substr(0,n)
    
  4. left(n)
    String.prototype.left = function(n) {
      return this.substr(0,n);
    };
    
  5. left(n)
    String.prototype.left = function(n) {
        return this.slice(0, n);