JS中判断对象是否为空
if (typeOf(x) == "undefined"){
alert("undefined");
}
else if (typeOf(x) == "null") {
alert("null");
}
或者简单那的用法是
if(!variable)
{}
if (typeOf(x) == "undefined"){
alert("undefined");
}
else if (typeOf(x) == "null") {
alert("null");
}
或者简单那的用法是
if(!variable)
{}