arobida
12/21/2017 - 4:08 PM

[Repeat String] Script that repeats a string #vanilla #script

[Repeat String] Script that repeats a string #vanilla #script

function repeatStringNumTimes(str, num) {
  // repeat after me
  if(num>=0){
      return str.repeat(num);
  } else {
    return "";
  }
}

//repeatStringNumTimes("abc", 3);