Basic JavaScript: Use Recursion to Create a Range of Numbers code example
Example 1: 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;
}
}
Example 2: Basic JavaScript: Use Recursion to Create a Range of Numbers
gfg h nhjytnrntnjymi, h fh dh g ffg d