main.js
1
2
3
4
5
6
7
8
9
10
function repeatStringNumTimes(str, num) {
  if(num < 0)
    return "";
  if(num === 1)
    return str;
  else
    return str + repeatStringNumTimes(str, num - 1);
}

repeatStringNumTimes("abc", 3);
Native Browser JavaScript