JS的未定义和undefined

Js中如果未定义对象然后判断是否等于undefined会报错,

要使用

if(typeof(username)=='undefined')

如果定义过了,可以直接使用

if(username==undefined)

其它需要注意的判断

if(null==undefined)  true

if(null===undefined) false

if(typeof null=="object") true

原文地址:https://www.cnblogs.com/zhaogaojian/p/12160912.html