javascript global object
//Access Global variable
var foo = "foobar";
foo === window.foo; // Returns: true
//Accessing Global Functions
function greeting() {
console.log("Hi!");
}
window.greeting();
javascript global object
//Access Global variable
var foo = "foobar";
foo === window.foo; // Returns: true
//Accessing Global Functions
function greeting() {
console.log("Hi!");
}
window.greeting();
global object in javascript
var x = {name: "John"}; // This is a global object
for(let i=0; i<10; i++){
// Variable x is alive here
// Variable i is alive here
let a = 3;
// Variable a is alive here
var y = 0;
// Variable y is alive here
}
// Variable i is dead here
// Variable a is dead here
// Variable x is alive here
// Variable y is alive here
console.log(x); // {name: "John"}
console.log(y); // 0
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us