0

Hello so i've been confused lately by the term Execution Context why is that so ? because i've seen that a lot of people referring Execution Contextto a lot of different things...

some say the Execution Context is the place where the code is executed

some say that Execution Context also contain all the variables of a function

In my opinion Execution Context is a function that is in process.

for example let's give a metaphor example

i'm the boss of a company and one of my worker called Bob. let's say i've written tasks in a page for Bob to do.

Bob is reading the page and he is doing everything the page saying line by line, now Bob encountered while reading a task that saying to read some other page so Bob is taking the other page and stack it on the page he read from. so now Bob is reading the other page after Bob finished reading the other page he moved it away. and keep reading the page he read before.

the Page is the "Execution Context"

basically Execution Contexts are the functions which are currently running and of course the Execution Context on top of the stack is the one who's getting executed.

That's what Execution Context is in my opinion.

Execution Context isn't also a Lexical Environment

am i right ?

Nadav Shlush
  • 47
  • 1
  • 8
  • Does this answer your question: [JavaScript execution contexts](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide/In_depth#javascript_execution_contexts) – jabaa Sep 16 '21 at 21:19
  • 1
    “*i will be glad to hear your opinion about what i've said.*” Questions seeking the opinions of the community are explicitly off-topic here per the scope of the site defined in the [help/on-topic]. Stack Overflow is not a discussion forum - questions here are expected to be answerable with facts backed up by authoritative sources. See also: [ask] – esqew Sep 16 '21 at 21:20
  • "*the place where the code is executed*" - that can mean anything. Is the CPU the "place" where code is executed? "*contain all the variables*" - they do contain all the variable values, amongst other things. "*a function that is in process.*" - not quite, an execution context is not a function. It's the data structure that says *that* a function is in process. "*let's give a metaphor example*" - i don't think that's a useful metaphor. The page (text) sounds more like code itself. A useful question: what is the metaphorical equivalent to recursive function calls? – Bergi Sep 16 '21 at 23:16

0 Answers0