6 lines
121 B
JavaScript
6 lines
121 B
JavaScript
|
|
String.prototype.repeat = function(n) {
|
||
|
|
return new Array(1 + n).join(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
alert("ha".repeat(5)); // hahahahaha
|