List of utility methods to do String Repeat
repeatify(numTimes)String.prototype.repeatify = function(numTimes) { var strArray = ""; for (var i = 0; i < numTimes; i++) { strArray += this; return strArray; }; console.log('hello'.repeatify(6)); | |
repeatify(times)String.prototype.repeatify = String.prototype.repeatify || function(times) { var str = ''; for (var i = 0; i< times; i++) { str +=this; return str; console.log("Jai Mata Di\n".repeatify(108)); | |
repeatify(times)String.prototype.repeatify = String.prototype.repeatify || function(times) { var str = ''; for (var i = 0; i < times; i++) { str += this; return str; }; console.log('hello'.repeatify(3)); | |
repeatify(times)'use strict'; String.prototype.repeatify = String.prototype.repeatify || function(times) { var str = ''; for (var i = 0; i < times; i++) { str += this; return str; }; console.log('hello'.repeatify(3)); ... | |
repeatify(times)String.prototype.repeatify = String.prototype.repeatify || function(times) { var string = ''; for (var i = 0; i < times; i++) { string += this; return string; console.log('Hello'.repeatify(5)); | |
repeatify(times)String.prototype.repeatify = String.prototype.repeatify || function(times){ var str = ''; for(var i=0; i<times; i++){ str +=this; return str; }; console.log('hello'.repeatify(3)); | |
repeatify(times)String.prototype.repeatify = String.prototype.repeatify || function(times) { var str = ''; for (var i = 0; i < times; i++) { str += this; return str; }; | |
repeatify(timesToRepeat)String.prototype.repeatify = function(timesToRepeat) { var string = this; for (var i = 1; i < timesToRepeat; i++) { string += this; return string; }; | |
repeatifyString.prototype.repeatify || (times)String.prototype.repeatify = String.prototype.repeatify || function (times) { var str = ''; for (var i = times; i--;) { console.log(i); str += this; return str; }; console.log('1 '.repeatify(6)) ... | |
repeatifyString.prototype.repeatify || (num)String.prototype.repeatify = String.prototype.repeatify || function(num){ "use strict"; let newString = ""; while(num >0){ newString +=this; num--; return newString; }; ... |