Repeat a string repeat a string help?

Repeat a string repeat a string help?
0

#1

Tell us what’s happening:
I don’t understand why the string doesn’t get printed out. Isn’t console.log used for printing?

Your code so far

function repeatStringNumTimes(str, num) {
  // repeat after me
  while(num>=0){
    console.log(str);
    num--;
  }
  if(num<0){
    console.log("");
  }
}

repeatStringNumTimes("abc", 3);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36.

Link to the challenge:


#2

Go to your browser’s console (Ctrl+Shft+J in Chrome) and you will see the results of your call to repeatStringNumTimes(“abc”, 3); (shown above) and all the results of the FCC tests.