Repeat a string

Tell us what’s happening:
the output is correct, but has “undefined” at the beginning of the string.
is there something wrong with my declaration?

Your code so far

function repeatStringNumTimes(str, num) {
  let myStr;
for (let i =0;i<num;i++){
myStr += str;
return myStr;

console.log(repeatStringNumTimes("abc", 3));

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0.

Challenge: Repeat a String Repeat a String

Link to the challenge:

undefined is the starting value of myStr, it comes from there

thanks a bunch :sweat_smile: didn’t see that one