Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is "Call stack" the same as "Execution context stack" in JavaScript?

Tags:

javascript

I often see the "Call stack" in many articles. like this: https://hackernoon.com/understanding-js-the-event-loop-959beae3ac40#ec22

enter image description here

But can't find the "call stack" in the ECMAScript document.
Is "Call stack" the same as "Execution context stack"?

enter image description here

like image 289
Bob Avatar asked Mar 13 '19 10:03

Bob


People also ask

Is execution stack same as call stack?

Execution stack, also known as “calling stack” in other programming languages, is a stack with a LIFO (Last in, First out) structure, which is used to store all the execution context created during the code execution.

What is execution context and call stack in JavaScript?

Whenever the JavaScript engine receives a script file, it first creates a default Execution Context known as the Global Execution Context (GEC) . The GEC is the base/default Execution Context where all JavaScript code that is not inside of a function gets executed. For every JavaScript file, there can only be one GEC.

What is the call stack in JavaScript?

A call stack is a mechanism for an interpreter (like the JavaScript interpreter in a web browser) to keep track of its place in a script that calls multiple functions — what function is currently being run and what functions are called from within that function, etc.

Is the call stack a stack?

In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, program stack, control stack, run-time stack, or machine stack, and is often shortened to just "the stack".


1 Answers

Сall Stack and Execution Stack are different names for the same thing. It is a LIFO stack that is used to store execution contexts created during code execution.

Wikipedia says: "This kind of stack is also known as an execution stack, program stack, control stack, run-time stack, or machine stack" https://en.wikipedia.org/wiki/Call_stack

One more quote: "In reality, the JavaScript engine creates what’s called an “Execution Stack” (also known as the “Call Stack”)." https://tylermcginnis.com/ultimate-guide-to-execution-contexts-hoisting-scopes-and-closures-in-javascript/

like image 74
Igor Litvinovich Avatar answered Nov 15 '22 13:11

Igor Litvinovich