0% found this document useful (0 votes)
6 views10 pages

Understanding JavaScript Engines

Key details of how javascript engine works

Uploaded by

mujtaba6616
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views10 pages

Understanding JavaScript Engines

Key details of how javascript engine works

Uploaded by

mujtaba6616
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JavaScript Engine

Muhammad Saifullah
How JavaScript runs behind
the browser?
► Parser: A Parser or Syntax Parser is a program that reads
your code line-by-line. It understands how the code fits the
syntax defined by the Programming Language and what it (the
code) is expected to do.

► 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. JavaScript engines are typically developed by web
browser vendors, and each major browser has one. Examples
include the V8 engine for Google chrome, SpiderMonkey for
Firefox, and Chakra for Internet Explorer.
How JavaScript Works?
Execution Context
► The Execution Context contains the code that's currently running, and
everything that aids in its execution.
► Execution Context is an environment in which our code is executed.

► Global Execution Context


► By Default
► JavaScript engine creates the global execution context before it starts to
execute any code
► Variables and function that is not inside any function.
Execution Context

► A New execution context gets created every time a function is


executed.
► A Global Object is also known as window object.

► For Example
► name == [Link]
► This === window
Execution Stack

► Execution Stack is also known as calling stack


► It is used to store all the execution context created
during the code execution.
► [Link]
-how-javascript-works-behind-the-scenes/#:~:text=First
%2C%20the%20script%20is%20loaded,%2C%20seco
nd%20%2C%20and%20third%20functions.
Execution Context -
Properties
► Creation Phase
► Variable Object are created
► Scope Chain are created
► ‘this’ keyword

► Execution Phase
► Execution context run line by line
Variable Object

► Property created in variable object


► Which is pointing to functions.(for function
declarations)
► Property created for variables but set to undefined.
.(for variable declarations)
► Argument object are created to pass as argument in a
function
ECMA Script
► NetScape – Browser

► Mocha LiveScript JavaScript

► MicroSoft – Internet Explorer


► Jscript

► European Computer Manufracturer’s Association


► ECMA – 262
► It is a standard for all the client –side script
► ES6
Compiler Vs Transpiler

You might also like