javascript 数据类型 undefined 和null

                                 数据类型

undefind

null

boolean

number

string

object

type of

功能:检测变量类型

语法:type of 变量或 type of (变量)

console.log() // 在控制台中打印

undefined的类型: 指是变量没有赋值

null :null指表示一个空对象指针

如果定义的变量准备在将来用来用于保存对象,那么最好将该变量初始值为null,而不是其他值

说明:

undefined值是派生自null值的,所以undefined == null 的返回结果是true。

       

猜你喜欢

转载自www.cnblogs.com/wuheng-123/p/9431167.html