Repeat a string repeat a string (Ananya)

Tell us what’s happening:
I have written this code and all the criterias given below meet exactly. Can someone tell where I’m going wrong?

Your code so far

function repeatStringNumTimes(str, num) {
  if (num<=0) {
    return "";
  } else {
  for (i=1; i<=num; i++) {
    arr.push(str);
  }
  
  return arr.join("");
}}

repeatStringNumTimes("*", 8);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36.

Link to the challenge:

1 Like