main.js
1
2
3
4
5
6
7
8
9
10
11
12
function repeatStringNumTimes(str, num) {
  var accumulatedStr = '';

  while (num > 0) {
    accumulatedStr += str;
    num--;
  }

  return accumulatedStr;
}

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