Nodejs String Padding Left lpad(padString, length)

Here you can find the source of lpad(padString, length)

Method Source Code

// Taken from http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/
//pads left/*from w w w.j av  a  2 s . c o  m*/
String.prototype.lpad = function(padString, length) {
   var str = this;
   while(str.length < length)
      str = padString + str;
   return str;
}

Related

  1. lpad(padString, length)
    String.prototype.lpad = function(padString, length) {
      var str = this;
      while (str.length < length)
          str = padString + str;
      return str;
    
  2. lpad(padString, length)
    String.prototype.lpad = function(padString, length) {
      var str = this;
        while (str.length < length)
            str = padString + str;
        return str;
    
  3. lpad(padString, length)
    String.prototype.lpad = function(padString, length) {
        var str = this;
        while (str.length < length)
            str = padString + str;
        return str;
    
  4. lpad(padString, length)
    String.prototype.lpad = function(padString, length) {
        var str = this;
        while (str.length < length)
            str = padString + str;
        return str;
    };
    
  5. lpad(padString, length)
    String.prototype.lpad = function(padString, length) {
      var str = this;
      while (str.length < length) {
        str = padString + str;
      return str;
    };
    
  6. lpad(padString, length)
    "use strict";
    String.prototype.lpad = function(padString, length) {
      let str = this;
      while (str.length < length)
        str = padString + str;
      return str;
    };
    
  7. lpad(padString, length)
    String.prototype.lpad = function(padString, length) {
      var str = this;
        while (str.length < length){
            str = padString + str;
        return str;
    
  8. lpad(padString, length)
    String.prototype.lpad = function(padString, length) {
      var str = this;
        while (str.length < length)
            str = padString + str;
        return str;
    
  9. lpad(pad_str, length)
    String.prototype.lpad = function(pad_str, length) {
      var str = this;
      while (str.length < length) str = pad_str + str;
      return str;