JS: String.prototype.repeat
New in JS2015.
String.prototype.repeat(count)
-
repeat a string.
"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
count
copy of it, joined together./* digit 9 to string, then repeat 2 times */ console.log( Reflect.apply( String.prototype.repeat , 9, [2] ) === "99" );
〔see JS: Reflect〕