if(myVar) { code }
will be NOT executed only when myVar
is equal to: false, 0, "", null, undefined, NaN
or you never defined variable myVar
(then additionally code stop execution and throw exception).if(myVar !== null) {code}
will be NOT executed only when myVar
is equal to null
or you never defined it (throws exception).Here you have all (src)
if
== (its negation !=)
=== (its negation !==)