how to declare object as global code example
Example: 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