Here you can find the source of repeatify(times)
// Basic alert//from ww w . j a va2s . c o m // console.log("hello from Me"); // Write something to web page // document.write("Hello Boulder"); // Variables // var nameList = 100; // // console.log(nameList); // Arrays // var arrayName = new Array(10, 20, 40, 4000, 200, "Dude!"); // // console.log(arrayName[3]); // console.log(arrayName[1]); // console.log(arrayName[0]); // console.log(arrayName[5]); // Define a repeatify function on the String object. The function accepts an integer // that specifies how many times the string has to be repeated. The function returns // the string repeated the number of times specified. For example: console.log('hello'.repeatify(3)); 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));
String.prototype.repeatify = function(numTimes) { var strArray = ""; for (var i = 0; i < numTimes; i++) { strArray += this; return strArray; }; console.log('hello'.repeatify(6));
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));
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));
'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)); ...
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));
String.prototype.repeatify = String.prototype.repeatify || function(times) { var str = ''; for (var i = 0; i < times; i++) { str += this; return str; };
String.prototype.repeatify = function(timesToRepeat) { var string = this; for (var i = 1; i < timesToRepeat; i++) { string += this; return string; };
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)) ...
String.prototype.repeatify = String.prototype.repeatify || function(num){ "use strict"; let newString = ""; while(num >0){ newString +=this; num--; return newString; }; ...