1let string = 'Plumbus'
2let count = 3
3
4string.repeat(count); // -> 'PlumbusPlumbusPlumbus'
1// hey buddy, here are different implementations, choose your favourite !!
2
3
4// best implementation
5repeatStr = (n, s) => s.repeat(n);
6
7
8// short
9function repeatStr(n, s) {
10 return s.repeat(n);
11}
12
13
14// without using repeat
15function repeatStr(n, s) {
16 var str = "";
17 for (var i = 0; i < n; i++) str += s;
18 return str;
19}