1
function repeatStr (n, s) { return new Array(n + 1).join(s); } console.log(repeatStr(5, "Hello")) // "HelloHelloHelloHelloHello"
2
function repeatStr (n, s) { return s.repeat(n); }