Here you can find the source of repeatify(times)
/**/*from w ww . j a v a2s . c o m*/ * JavaScript objects only have one construct, objects. Each object has an internal link to another object called its Prototype. This Prototype object has a Prototype of its own, and so on until an object is reached with a null as its Prototype. * - this is called the Prototype chain * * Extending natice prototypes: this is considered bad practice and breaks encapsulation. The only good reason for extending a built-in prototype is to backport the features of newer JavaScript engines. */ 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 = function(n) { var str = '' for (var i = 0; i < n; 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 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 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)) ...