ECMAScript の仕様では、コールスタックは「実行コンテキストスタック(execution context stack)」と呼ばれます。関数を呼ぶたびに実行コンテキストが 1 つ作られ、スタックに積まれます。
The running execution context is always the top element of this stack. A new execution context is created whenever control is transferred from the executable code associated with the currently running execution context to executable code that is not associated with that execution context.
出典: https://tc39.es/ecma262/#sec-execution-contexts(取得日: 2026-09-21)
実行中なのは常に一番上の 1 つだけで、その下にいるのは「自分が終わるのを待っている呼び出し元」です。実際に見てみます。a が b を、b が c を呼び、c の中で呼び出し履歴の関数名を出します。
// stack.js
// 呼び出し履歴の関数名だけを、新しい順に返す(先頭の names 自身は除く)
function names() {
return new Error().stack
.split('\n')
.slice(2)
.map((line) => line.trim().split(' ')[1])
.join(' <- ');
}
function c() { console.log(names()); }
function b() { c(); }
function a() { b(); }
a();
一番上が c、その下に b、a と続き、Object.<anonymous>(スクリプト本体)から Node 内部の読み込み処理までが土台になっています。
なお Error.stack に載るのは既定で 10 フレームまでです(V8 の Error.stackTraceLimit)。上の出力も途中で切れているので、スタックの総数を数える用途には使えません。