Answers for "how to repeat string in js"

8

string repeat javascript

// best implementation
repeatStr = (n, s) => s.repeat(n);
Posted by: Guest on August-17-2020
0

Repeat a String Repeat a String-Javascript

function repeatStringNumTimes(str, num) {
  if (num < 1) {
    return "";
  } else {
    return str + repeatStringNumTimes(str, num - 1);
  }
}
Posted by: Guest on December-09-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language