Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Repeat a String Repeat a String-Javascript

function repeatStringNumTimes(str, num) {
  if (num < 1) {
    return "";
  } else {
    return str + repeatStringNumTimes(str, num - 1);
  }
}
Source by forum.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #Repeat #String #Repeat
ADD COMMENT
Topic
Name
4+6 =