countdown(10) should return [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] countdown(5) should return [5, 4, 3, 2, 1]
function countdown(n) {
if (n < 1) {
return [];
} else {
const arr = countdown(n - 1);
arr.unshift(n);
return arr;
}
return myArray;
}
console.log(countdown(-1));