preferisco
if (null == yourvar)
che evita l'assegnazione accidentale in questo scenario
if (yourvar = null)
Modifica
JavaScript ha sia rigorosa e il tipo di conversione confronto di uguaglianza. Per uguaglianza rigorosa gli oggetti confrontati devono avere lo stesso tipo e:
* Two strings are strictly equal when they have the same sequence of characters,
same length, and same characters in corresponding positions.
* Two numbers are strictly equal when they are numerically equal (have the
same number value). NaN is not equal to anything, including NaN.
Positive and negative zeros are equal to one another.
* Two Boolean operands are strictly equal if both are true or both are false.
* Two objects are strictly equal if they refer to the same Object.
tipi null e undefined sono == (ma non ===)
Leggi Comparison Operators
usare '===' e '! ==' – jantimon
Cosa intendi per "affidabile"? – rjmunro
** vedi anche: ** http://stackoverflow.com/questions/24318654 – dreftymac