Javascript String repeat(chr, count)

Description

Javascript String repeat(chr, count)


/*//  ww  w. ja v  a2  s .  c om
 * Copyright (c) 2014 INSciTE.  All rights reserved
 * INSciTE is on the web at: http://www.hightechkids.org
 * This code is released under GPL; see LICENSE.txt for details.
 */

String.repeat = function(chr, count) {
 var str = "";
 for (var x = 0; x < count; x++) {
  str += chr;
 }

 return str;
};



PreviousNext

Related