Javascript String times(amount)
String.prototype.times = function(amount) { var string = [] while (amount-- > 0) string.push(this)// ww w . ja v a 2 s. c om return string.join(" ") }
String.prototype.times = function(amount) { var that = this; return [].range(1, amount).map(function(){ return that;/* w ww . j a v a2s . com*/ }).join(" "); };
String.prototype.times = function(amount){ var i = 0;/* www. j a va 2s . co m*/ var b = ""; while(i < amount){ b += this.toString() + " "; i++; } //var that = this; //return [].range(1,amoun).map(function(_){ return that}).join(" "); return b; };
String.prototype.times = function (amount) { return new Array(amount + 1).join(this + " "); };