Hi everyone,
I’ve been working on this code and been having some trouble with it. I think it has something to do with the for loop.
This function should take a number, and create an array of numbers counting down from this number to 0.
function countdown(start) {
for (let i = 0; i <= start; i++) {
start.push[i];
}
return start.reverse();
}
I keep getting this error…
TypeError: Cannot read property '0' of undefined
at countdown
I cannot seem to find out what the problem is… Is there anyone that can possibly help me with this?
Thanks,
Peter