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 :: javaScript setDate() Method 
Javascript :: how to see my timezone using js 
Javascript :: window onload 
Javascript :: how to add footer in every page jspdf 
Javascript :: angular ng class with animation 
Javascript :: audio element javascript 
Javascript :: how to run cypress test 
Javascript :: for each array 
Javascript :: node.js parameters 
Javascript :: add one month to date javascript 
Javascript :: angular http async false 
Javascript :: document.queryselector 
Javascript :: socket emit to 
Javascript :: Match an object in a string using ReGex 
Javascript :: array mdn map 
Javascript :: javascript combining arrays 
Javascript :: countdown js 
Javascript :: start live server react js 
Javascript :: arrow function 
Javascript :: sort numbers in array javascript 
Javascript :: how to get MathJax 
Javascript :: age validation jquery 
Javascript :: js compare objects 
Javascript :: how to go back to previous route in next.js 
Javascript :: javascript ISO Date Formats 
Javascript :: javascript console.log colors 
Javascript :: string splice 
Javascript :: react.lazy 
Javascript :: form data display javascript 
Javascript :: form contact 7 ajax send 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =