Help me:
i just follow how to create recursion from the last lesson, and change it a bit and i now i dont know why it didnt work.
My code so far
function rangeOfNumbers(startNum, endNum) {
if (startNum >= endNum) {
return [];
} else {
const array = rangeOfNumbers(startNum - 1);
array.push(startNum);
return array;
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
.
Challenge: Use Recursion to Create a Range of Numbers
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers