Node.js examples for String:Repeat
Repeat a String
String.prototype.repeat = function(count) { if (count < 1) return ''; var result = '', pattern = this.valueOf(); while (count > 1) { if (count & 1) result += pattern; count >>= 1, pattern += pattern; }//from w w w . j av a2 s. co m return result + pattern; };