留作备忘
原地址http://www.cnblogs.com/imlucky/archive/2013/05/22/3093355.html
//判断undefined:
var tmp = undefined;
if (typeof(tmp) == "undefined"){
alert("undefined");
}
//判断null:
var tmp = null;
if (!tmp && typeof(tmp)!="undefined" && tmp!=0){
alert("null");
}
//判断NaN:
var tmp = 0/0;
if(isNaN(tmp)){
alert("NaN");
}
//判断undefined和null://
var tmp = undefined;
if (tmp== undefined)
{
alert("null or undefined");
}
var tmp = undefined;
if (tmp== null)
{
alert("null or undefined");
}
//说明:null==undefined
//判断undefined、null与NaN://
var tmp = parseInt("sdfe");
if ((!tmp)&&(tmp!=0))
{
alert("null or undefined or NaN");
}