First take a look at the following code.
var a ;
var b = undefined ;
// alerts "false"
alert (b == a ) ;
a and b are undefined, but they are NOT equal. Now let’s see where it can become a problem.
We have an object with one member variable that is not defined.
var f1 = function ( )
this. myvar ;
var obj1 = new f1 ( ) ;
Now you’d like to know whether the object “b” has the property “myvar”. There are lots of examples online, but what’s the right way?
what is typeof typeof ‘string’ ?
what is typeof typeof?
The first one is “string”. Yes if there you have the following code:
that gives of course undefined, but if there is typeof typeof something_undefined the answer is string, because “udefined” itself is a string.
typeof vs ==
It simply should be:
typeof variable == ‘undefined’