undefined is just the default property of a global object that you can override / override. This is why you should always test undefined with typeof x == 'undefined' , since the typeof operator cannot be overridden.
var undefined; if(x == undefined){
What happens here is that you are defining a new variable called "undefined" that you are not assigning a value to and therefore getting an undefined value. x also not defined, and also has the value undefined . Therefore, both are equal. This is pretty pointless.
deceze May 20 '11 at 2:00 a.m. 2011-05-20 02:00
source share