Tell us what’s happening:
why arr is not defined ?
Your code so far
function rangeOfNumbers(startNum, endNum) {
if (startNum <= endNum) {
var arr = rangeofNumbers(startNum + 1, endNum);
arr.unshift(startNum);
return [arr];
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
.
Challenge: Use Recursion to Create a Range of Numbers
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
ILM
August 15, 2020, 1:00pm
2
islamkh488:
rangeOfNumbers
islamkh488:
rangeofNumbers
you are using two different function names
also:
if this is false, your function returns undefined
meaning the function rangeOfNumbers(endNum, endNum)
will returns undefined, and not a value usable in the snippet below: