countDownFrom(--n) There's no reason to reassign the decremented n within the function. Prefer: countDownFrom(n - 1)
function countDownFrom(n) {
console.log(n)
if (n > 0) {
countDownFrom(n - 1)
}
}
This removes both the decrement operator and the return keyword, both of which distract from the concept being taught.This would also make it simple to add a `step` argument, which could be written as:
function countDownFrom (n, step) {
console.log(n)
if (n > 0) {
countDownFrom(n - step, step)
}
}