特殊类型
undefind,只声明变量,不给变量赋值
JS
1
2
let a
console.log(a) // undefind
undefind 和 null 的区别
undefind 代表声明变量但是没有赋值 null 表示赋值了,但是赋值为 null
JS
1
2
let a // undefind
let b = null //null
他的的计算区别
JS
1
2
console.log(undefind + 1 ) // NAN not a number 计算错误
console.log(null + 1 ) // 1