let a = {};
console.log(window.a);
console.log(a);
why is result:
undefined
Object
rather than both Object
Updated: How do I access global a from within this function without going to Var?
let a = {
func1() {
let a = 'something'; // local a
// need to access the global a not the local a here
window.a.func2();
},
func2() {
}
};