null 和 undefined
来源:互联网 发布:mac鼠标指针主题包 编辑:程序博客网 时间:2024/06/11 09:21
ECMA-262中的定义:
Undefined
The Undefined type has exactly one value, called undefined. Any variable that has not been assigned a valuehas the value undefined.
Null
The Null type has exactly one value, called null.
var a;
alert(a);//undefined
alert(typeof a);//undefined
alert(typeof b);//undefined
alert(typeof undefined);//undefined
alert(typeof null);//object 被认为是对象的占位符
alert(null == undefined);//true EcmaScript中认为他们是相等的。
关于undefined
1、声明过变量在被赋值之前的默认值是undefined。
2、它是window的一个属性,alert('undefined' in window);//true。
3、可以在局部作用域中定义一个undefined达到优化目的。
4、函数未指明返回值(无return),也是undefined。
关于null
The null value is a primitive value that represents the null, empty, or non-existent reference.
EcmaScript的5种原始数值
Null Undefined Boolean Number String
- null 和 undefined
- typeof、undefined 和 null
- JS:Undefined 和 Null
- undefined和null
- javascript null和undefined
- null和undefined
- undefined 和 null
- Null和Undefined类型
- null和undefined
- undefined 和 null
- null和undefined
- null和Undefined区别
- js--null和undefined
- JavaScript null 和 undefined
- null和undefined
- 区别null和undefined
- null和undefined
- 比较Undefined 和 null
- CFile和CStdioFile的文件读写使用方法
- LPTSTR CString 相互转换 CString char * 相互转换
- 什么是 RTB
- 各种集合的区别
- 网址
- null 和 undefined
- break与continue区别
- hdu 1087
- ON_COMMAND和ON_MESSAGE的区别
- android 四大组建
- 单点登录
- NPOI 创建 Excel 出错“此文件中的某些文本格式可能已经更改,因为它已经超出最多允许的字体数。关闭其他文档再试一次可能有用。”
- 【翻译】Dalvik——如何控制vm
- 2012年4月23日-flex4中替代Box的组件scroller加Group