Javascript String rightJustify( length, char )

Description

Javascript String rightJustify( length, char )


String.prototype.rightJustify = function( length, char ) {
  var fill = [];/*from   w  w w  .  j ava  2  s  .  co m*/
  while ( fill.length + this.length < length ) {
    fill[fill.length] = char;
  }
  return this + fill.join('');
};



PreviousNext

Related