This already has an answer on Stack Overflow. It's using
Chrome developer console screenshot
In this tests, there's an undeclared variable called
The recommended method
On JSLint, this method throws
Unexpected 'typeof'. Use '===' to compare directly with undefined.
To fix that, simply declare the gonna-be-initialized-later variable as a
var. Then compare that variable directly with the
undefined property using triple equals (
===). Or using Boolean negation.
On Chrome console: