JavaScript判断对象 是什么类型的.

// 这种方法不起作用 
if (x == undefined)
{
  // 作某些操作 
}

// 这个方法同样不起作用-
if (typeof(x) == undefined)
{
  // 作某些操作 
}
// 这个方法有效 
if (typeof(x) == "undefined")
{
  // 作某些操作 
}
  
原文地址:https://www.cnblogs.com/sunzhenyong/p/4045257.html