function count(n) {
if (n === 1) {
return [1];
} else {
var numbers = count(n - 1);
numbers.push(n);
return numbers;
}
}
If you call function count(5) it gives 1,2,3,4,5. However somethings are unclear in the count function. (1) Var numbers is never declared as an array so i don’t know why we are able to push into it like an array. (2) I expect the n-1 that first run to be 4, so i expect the end result to be something like 4,3,2 and not 1,2,3,4,5.