JS 判断变量是否为 undefined

JS 判断变量是否为 undefined

小Z 技术 5年前 4 0

js 新手在判断变量是否是 undefined 时,很自然的写出了下面的代码: 结果无法正常判断,上网查询了一下,正确做法是使用 typeof 函数:

扫一扫二维码分享