Consider:
var myString = new String("Hello world");
alert(myString.noSuchValue); // undefined
alert(myshit); // This results in error, and not the above one
Both of them, i.e.
- property
noSuchValue
on objectmyString
, - variable
myshit
are undefined.
But why do I get an error for myshit
and not for the object property case?