首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > VSTS >

JavaScript - null VS undefined

2012-09-10 
JavaScript ---- null VS undefined共同点:1, null and undefined both indicate an absence of value.2.

JavaScript ---- null VS undefined
共同点:
1, null and undefined both indicate an absence of value.
2. Both are falsy values-----they behave like false when a boolean value is required.
3. Neither null or undefined have any properties or methods.

不同点:
1. The equality operator== considers them to be equal.
   Use the strict equality operator === to distinguish them
2. You might consider undefined to represent a system-level, unexpected, or error-like absence of value.
   Null to represent program-level, normal, or expected absence of value.

热点排行