Basic JavaScript - Use Recursion to Create a Range of Numbers

Tell us what’s happening:
i’m facing difficulties with my code please tell me whats wrong

Your code so far

function rangeOfNumbers(startNum, endNum) {
  if (startNum <= endNum) {
     return [];
  } else {
    const arr = rangeOfNumbers(startNum - 1, endNum - 1);
    return arr.push(startNum, endNum)

 console.log(rangeOfNumbers(1, 5));

here’s the link to the task:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.