Tell us what’s happening:
Hi everyone, I am sure i applied the recursion into my code and it outputs the correct arrays and passes all the tests, but the test still fails on 5. rangeOfNumbers should use recursion (call itself) to solve this challenge.
As to not reveal the full function code, I just changed my inner logic to js comment.
Your code so far
const rangeOfNumbers = (startNum, endNum) => {
//initialise an array
//if the starting number is greater than ending number,
//return the array.
//Otherwise, assign the recursive function
//back to the array and push the ending number
//into the array then return it.
}
console.log(rangeOfNumbers(1, 5)); //T6
console.log(rangeOfNumbers(6, 9)); //T7
console.log(rangeOfNumbers(4, 4)); //T8
console.log(rangeOfNumbers(10, 15)); //T9
console.log(rangeOfNumbers(2, 8)); //T10
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/154.0.0.0 Safari/537.36
Challenge Information:
Build a Range of Numbers Generator - Build a Range of Numbers Generator