JavaScript必知必会(二) null 和undefined
2019/6/27 22:22:09
本文主要是介绍JavaScript必知必会(二) null 和undefined,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
null
null 表示个“空” ,
使用typeof (null) ;//Object ; 说明他是一个特殊的对象。
null 类型只自己唯一个成员。他是不包含属性和方法的。
undefined
undefined 同样也是表示"空",
使用typeof (undefined) ;//undefined ;说明他是undefined类型的。
undefined 类型只包含自己一个成员,他不包含属性和方法的。
summary
null 和 undefined 在莫种意义上可以一样 ,比如都可以转换成布尔值,表示 false;
null 和 undefined 都不能使用. 和[] 来取成员值,所以在使用应先判断对象是否是null 或undefined。
这篇关于JavaScript必知必会(二) null 和undefined的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-30[OIDC in Action] 2. 基于OIDC(OpenID Connect)的SSO(纯JS客户端)
- 2024-03-29terraform jsonencode
- 2024-03-13vuex-persist
- 2024-03-11icons for vue
- 2024-03-07breadcrumbs react js
- 2024-03-06react login page example
- 2024-03-06react router uselocation
- 2024-03-04postgres jsonb_set
- 2024-03-01react native uuid
- 2024-02-29vuejs sidebar