Repeat a string: Difference between revisions
Content added Content deleted
(→{{header|JavaScript}}: using n in an arithmetic operation converts it to a number automatically) |
|||
Line 356:
This solution creates an array of n+1 null elements, then joins them using the target string as the delimiter
<lang javascript>String.prototype.repeat = function(n) {
return new Array(1 +
}
|