call stack: 函数调用栈。
let num = 123;
function first(num) {
second(num);
console.log('first');
}
function second(num) {
third(num);
console.log('second');
}
function third(num) {
console.log(num);
}
first()
执行结果:123 second first
first()执行,first先入栈位于栈顶,first调用second(),进阶second入栈位于栈顶,second调用third(),third入栈位于栈顶。栈是后入先出,此时third位于栈顶,因此打印出123,third出栈,second位于栈顶,打印‘second',second出栈,first位于栈顶,打印’first‘。
stack:栈(一种线性数据结构,先入后出FILO)。