This test will always work as expected:
typeof a === 'undefined'
Since the value undefined can be changed, such tests are not always reliable:
a = {} ab === undefined
In these cases, you can test instead of void 0 :
ab === void 0 // true
However, this will not work for single variable tests:
a === void 0
You can get around this by testing against window.a , but it is preferable to use the first method.
Ja͢ck
source share