Just a simple question :)
if I have :
var user = {'name': 'Fred'};
So
console.log(user.name); // Fred
console.log(user.age); // undefined
But
console.log(test); // ReferenceError: test is not defined
I don't understand why because for me it's the same as
console.log(window.test); // undefined
In my project, i try to check if a global variable exist but I have a referenceError... I don't really understand why the followinf code doesn't work...
if (TestGlobal) // ReferenceError: TestGlobal is not defined
console.log(' allo 1 ');
if (typeof(TestGlobal ) !== 'undefined') // Ok
console.log(' allo 1 ');