JS中判断对象是否为空

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

或者简单那的用法是

if(!variable)

{}

原文地址:https://www.cnblogs.com/yanluckly/p/1356772.html