javascript global object 1

javascript global object

//Access Global variable
var foo = "foobar";
foo === window.foo; // Returns: true


//Accessing Global Functions
function greeting() {
   console.log("Hi!");
}

window.greeting(); 

Here is what the above code is Doing:
1. The function greeting() is defined.
2. The function is called using the window object.
3. The function is executed.

Similar Posts