Repeat a string repeat a string?

My solution to this after searching through the mozilla documentation, was to use the string repeat method. The exercise text doesn’t say we can’t use this, but it seems too easy…? I can imagine doing it other ways with a loop, though is it necessary?

function repeatStringNumTimes(str, num) {
  // repeat after me
  if (num > 0) {
    return str.repeat(num);
  }
  else return "";
}

repeatStringNumTimes("abc", 3);

I did this too

function repeatStringNumTimes(str, num) {
  return (num < 0) ? '' : str.repeat(num)
}
repeatStringNumTimes("abc", 3) // abcabcabc

Interested to hear from those more experienced if a loop would be the better approach and why?
I’ve come across a couple of others that I thought - hmm must be more to it, but then again reading the docs is half the battle.