Answers for "recursion range javascript"

2

Basic JavaScript: Use Recursion to Create a Range of Numbers

function rangeOfNumbers(startNum, endNum) {
  if (endNum - startNum === 0) {
    return [startNum];
  } else {
    var numbers = rangeOfNumbers(startNum, endNum - 1);
    numbers.push(endNum);
    return numbers;
  }
}
Posted by: Guest on December-20-2019

Code answers related to "recursion range javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language