Why is the execution context not created here?

Writing the following result will evaluate the function of the Function constructor, which will result in the presence of a property in the global object that points to the instance of the Foo object.

 function Foo() {} 

Execution contexts are created when functions are called, so does it have a different execution context than the global one, which was created even without calling Foo ?

My thinking is as follows:

All this is an object in JavaScript (with minor exceptions related to primitives). Objects are created by functions. Foo is an object. The function is called.

+1
source share
1 answer

Answering my own question based on the long list of comments above.

An execution context is not created because execution contexts make sense only for custom code. For the internal operation of the JavaScript engine, such as the exact mechanism for creating the Foo object object in the code, the developers remain the question.

0
source

Source: https://habr.com/ru/post/978898/


All Articles