![]() There are two kinds of Execution Context in JavaScript: #ALTERNATIVE CLASS FOR ICEFACES JAVASCRIPT CONTEXT CODE#The Execution Context contains the code that's currently running, and everything that aids in its execution.ĭuring the Execution Context run-time, the specific code gets parsed by a parser, the variables and functions are stored in memory, executable byte-code gets generated, and the code gets executed. This environment is known as the Execution Context. The browser's JavaScript engine then creates a special environment to handle the transformation and execution of this JavaScript code. While reading through HTML, if the browser encounters JavaScript code to run via a tag or an attribute that contains JavaScript code like onClick, it sends it to its JavaScript engine. It needs to be converted into a format that the browser and our computers can understand – machine code. How JavaScript Code Gets Executedįor does who don't know, the browser doesn't natively understand the high-level JavaScript code that we write in our applications. Now, that we've gotten those out of the way, let's dive in. Function Declarations: These are functions that are assigned a name.įunction doSomething().Examples include the V8 engine for Google chrome, SpiderMonkey for Firefox, and Chakra for Internet Explorer. JavaScript engines are typically developed by web browser vendors, and each major browser has one. JavaScript Engine: A JavaScript engine is simply a computer program that receives JavaScript source code and compiles it to the binary instructions (machine code) that a CPU can understand.It understands how the code fits the syntax defined by the Programming Language and what it (the code) is expected to do. Parser: A Parser or Syntax Parser is a program that reads your code line-by-line.In this article, we'll take a look at everything that happens behind the scenes for JavaScript code to run in a web browser.īefore we dive in, here are some prerequisites to familiarize yourself with, because we'll use them often in this article. In most cases, that environment would be a web browser.įor any piece of JavaScript code to be executed in a web browser, a lot of processes take place behind the scenes. All JavaScript code needs to be hosted and run in some kind of environment. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |