日期:2014-05-16  浏览次数:20322 次

JS中判断对象是否为空

if ? (typeOf(x) ? == ? "undefined"){ ?
? ? ? alert("undefined"); ?
? } ?
? else ? if ? (typeOf(x) ? == ? "null") ? { ?
? ? ? alert("null"); ?
? }

或者简单那的用法是

if(!variable)

{}