有人可以解释这个递归函数的输出吗?谢谢!
function test(a) {
while (a > 0) {
a -= 1;
test(a);
console.log('after first invocation: ' + a);
}
}
test(3);
输出:
after first invocation: 0
after first invocation: 1
after first invocation: 0
after first invocation: 2
after first invocation: 0
after first invocation: 1
after first invocation: 0