Javascript String repeat( count ) method 2

Description

Javascript String repeat( count ) method 2


String.prototype.repeat = function( count ) {
  var s = "";
  while( count > 0 ) {
    count--;//from  ww  w.  j  ava  2 s.c  om
    s += this;
  }
  return s;
}



PreviousNext

Related