In this exercise we are asked to write a function which should return an array of integers which begins with a number represented by the startNum parameter and ends with a number represented by the endNum parameter.
So deriving from the previous example of countup , here is how this would work
function rangeOfNumbers(startNum, endNum) {
if(startNum>endNum){
return[]
}
const rangeArray=rangeOfNumbers(startNum,(endNum-1))
rangeArray.push(endNum)
return rangeArray;
};
Top comments (0)