Javascript String leftJustify( length, char )

Description

Javascript String leftJustify( length, char )

String.prototype.leftJustify = function( length, char ) {
  var fill = [];//from ww w  .jav a2 s .c om
  while ( fill.length + this.length < length ) {
    fill[fill.length] = char;
  }
  return fill.join('') + this;
}



PreviousNext

Related