JavaScript Sprawdź zmienne zerowe
var myVar=null;
if(myVar === null){
//I am null;
}
if (typeof myVar === 'undefined'){
//myVar is undefined
}
Grepper
var myVar=null;
if(myVar === null){
//I am null;
}
if (typeof myVar === 'undefined'){
//myVar is undefined
}
console.log(null === null); // true
console.log(undefined === undefined); // true
console.log(null + undefined === null + undefined); // false
// null + undfined equals NaN, and NaN isn't equal to itself :(
//loosely equal (compare values between two variables)
null == undefined // true ( null => 0 , undefined => NAN)
//strictly not equal (compare both type and value)
null === undefined // false (typeof null => object , typeof undefined => undefined)
null !== undefined // true (typeof null => object , typeof undefined => undefined)