Javascript String repeat(count)
String.prototype.repeat= function repeatString(count){ var result=''; for (var i = 0; i < count; i++) { var obj = person[i]; result+=this;/* w w w.jav a 2 s. c o m*/ } return result; }; console.log('hi'.repeat(3));