Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

what is global execution context in javascript


In JavaScript, the global execution context is the default execution context. 

It is created when the JavaScript interpreter starts to run your code. 

The global execution context has two properties: the global object and the this keyword. 

The global object is the object that represents the window in a browser, or the global scope in Node.js. 

The this keyword refers to the global object.
Comment

global execution context javascript

1)Before your javascript(.js) file run there is global execution context
that is created even file is empty.Two phase Creation phase and Execution Phase.
2)In creation phase GEC create global object and this.In browser global object 
will be browser.Javascript engines allocate memory for function even before your
code run.
3)After creation phase,There is Execution phase.

sayHi() //hello
function sayHi(){
console.log("hello")
}

Javascript already know your function even before it is executed
because of hoisting as in creation phase it memorized all javascript function 
declaration.

sayHi(); //error out because of sayHi is const varible not exact function.
const sayHi= function (){
console.log("hey")
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: get request react 
Javascript :: javascript last element of array 
Javascript :: javascript open new window 
Javascript :: iframe player youtube onfinish event 
Javascript :: slice string javascript from index to space 
Javascript :: javascript get last item in array 
Javascript :: asp.net core 3.1 convert system.string[] to javascript 
Javascript :: nodejs get all folders in directory 
Javascript :: how to add parameters to url javascript 
Javascript :: push state array react 
Javascript :: replace regex javascript 
Javascript :: js array sum 
Javascript :: refresh event in javascript 
Javascript :: how to copy text in js 
Javascript :: rgb to hex js 
Javascript :: split a message 
Javascript :: javascript get keycode from char 
Javascript :: number validation in javascript 
Javascript :: how to return 5 records instead of 10 records in datatable in laravel 
Javascript :: google maps init map 
Javascript :: read from s3 bucket nodejs 
Javascript :: send file discord js v12 
Javascript :: js open window in new tab 
Javascript :: string split javascript newline 
Javascript :: express ejs layout use different layout 
Javascript :: javascript multiples of 3 and 5 
Javascript :: javascript date to string format 
Javascript :: generate 50 random numbers between 1 and 500 in javascript 
Javascript :: moment month start date and end date 
Javascript :: xmlhttprequest response 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =