Search code examples
javascriptfunctionexecution

Does javascript creates a execution context for every function?


I am watching a course where the professor mentions a local execution context being created every time we execute a function created by ourselves (he does not says exactly that, however he does not mentions this when he explains external functions like setTimeOut or fetch). However what happens when we call an external function (like setTimeOut or fetch) does javascript creates a local execution context for this functions too? What I mean by external functions is functions not created by ourself but part of an API.


Solution

  • Most external functions for javascript are actually written in C, so they don't have a javascript execution context per se. However, they still have a stack frame, which is similar to what a javascript execution context is.