Repeat a string repeat a string. What trick do I need to pull this off?

Repeat a string repeat a string. What trick do I need to pull this off?
0

#1

Tell us what’s happening:

Your code so far

function repeatStringNumTimes(str, num) {
  // repeat after me
  return str;
}

repeatStringNumTimes("abc", 3);

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.132 Safari/537.36.

Link to the challenge:


#2

Did you follow the suggested link? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String

You’ll find a link there to one of the string methods, called ‘repeat’: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat

Hopefully that helps. Do ask further if you’re still not sure how to use it.


#3

Before trying to write the code, have you tried to write out an algorithm in plain language to make sure you understand what steps your code would need to take in order to meet the challenge requirements? Post your algorithm in written steps and/or pseudo-code if you prefer and we can help guide you in your logic.