Repeat a String Repeat a String Issue

following is my solution . The console.log details are correct and as expected but still could not run the test. Am I missing something?

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

  let newStr = [];
  for(let i=1; i <= num; i++) {
  return newStr;

repeatStringNumTimes("abc", 2);

Your browser information:

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

Link to the challenge:

Can you format your code and add a link to the exercise?

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.


  return newStr;

You display a joined version of newStr to the console, but then you only return newStr. newStr is an array and the return value should be a string.