function rangeOfNumbers(startNum, endNum) {
if(startNum<=endNum)
{
const arrNumber = rangeOfNumbers(startNum, endNum-1);
arrNumber.push(endNum);
return arrNumber;
}
else {
return [];
}
};
console.log(rangeOfNumbers(6,8));//[6,7,8]
console.log(rangeOfNumbers(3,12));//[ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]
Comments
Post a Comment