Nodejs String Sub String from Right right(num)

Here you can find the source of right(num)

Method Source Code

String.prototype.right = function(num) {
   var thisLength = this.length;
   var howMuchLettersNeedToBeRemooved = thisLength - num;
   var endsString = this.substring(howMuchLettersNeedToBeRemooved);
   return endsString;
}

Related

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