Questions about the execution context of Eval, entering and leaving the context stack ECStack

first quote original

in-depth understanding of the JavaScript series (11): execution context (Execution Contexts)

The
eval code is a little interesting. It has a concept: calling context (calling context), for example, the context generated when the eval function is called. The eval (variable or function declaration) activity affects the calling context (calling context).
eval("var x = 10");
 
(function foo() {
  eval("var y = 20");
})();
 
alert(x); // 10
alert(y); // "y" 
ECStack:

ECStack = [
  globalContext
];
 
// eval("var x = 10");
ECStack.push(
  evalContext,
  callingContext: globalContext
);
 
// eval exited context
ECStack.pop();
 
// foo funciton call
ECStack.push(<foo> functionContext);
 
// eval("var y = 20");
ECStack.push(
  evalContext,
  callingContext: <foo> functionContext
);
 
// return from eval
ECStack.pop();
 
// return from foo
ECStack.pop();
< hr >

take eval ("var x = 10"); as an example, when the controller enters the Eval function, it will give ECStack push two elements: evalContext, callingContext:globalContext,
there are three elements in the ECStack at this time,
ECStack = [globalContext, evalContext, CallingContext:globalContext]

my question is:
/ / eval exited context
ECStack.pop ();
will one CallingContext:globalContext, pop up or two CallingContext:globalContext,evalContext elements pop up in this step?
I think two elements should pop up, but I remember pop can only manipulate one element, so evalContext will remain in ECStack.

Mar.11,2021

it's not your problem, it's the translation. You can read the original of that blog. The original push is an object , which has two attributes, one context and one callingContext , so pop once is enough:

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b364e7-343b2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b364e7-343b2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?