有没有人会解释为什么下面的结果有所不同?
// test one
function computeMaxCallStackSize() {
try {
return computeMaxCallStackSize() + 1;
} catch (e) {
return 1;
}
}
console.log(computeMaxCallStackSize());
Run Code Online (Sandbox Code Playgroud)
结果是17958
// test two
function computeMaxCallStackSize() {
try {
return 1 + computeMaxCallStackSize();
} catch (e) {
return 1;
}
}
console.log(computeMaxCallStackSize());
Run Code Online (Sandbox Code Playgroud)
结果是15714
当函数'computeMaxCallStackSize'的位置不同时,结果也不同.什么原因?非常感谢!
运行环境:
node.js v6.9.1
OS:Win7