If you somehow cannot refrain from shadowing global undefined or cannot but try to refer to undeclared variables, use:
typeof x === 'undefined'
If you adhere to good coding rules and believe that you allow code breaking, use:
x === undefined
If you want another alternative, you can use:
x === void 0;
... where void always returns undefined and does not rely on a global property.
Another protection you can use is to use the shadow image in a good way, defining the correct undefined in the function:
(function( undefined ) {
... some people prefer to use a different name:
(function( undef ) {
source share