JS: String.prototype.repeat
(new in ECMAScript 2015)
String.prototype.repeat(count)-
repeat a string.
console.assert("a".repeat(2) === "aa"); The function can also work on Value Types othe than string. It will first convert this (binding) to string, then return
countcopy of it, joined together./* digit 9 to string, then repeat 2 times */ console.assert(Reflect.apply(String.prototype.repeat, 9, [2]) === "99"); [see JS: Reflect (namespace)]