JavaScript/Null:修订间差异
来自康健生活
| 第30行: | 第30行: | ||
Null 被认为是对象的占位符,以此解释 Null 的 typeof 返回为 Object 的历史问题。 | Null 被认为是对象的占位符,以此解释 Null 的 typeof 返回为 Object 的历史问题。 | ||
== 判断为null == | |||
{{leftrightflex|<syntaxhighlight lang="javascript"> | |||
Object.prototype.toString.call(null) === '[object Null]'</syntaxhighlight>|{{consoleout|<pre>true | |||
</pre>}}}} | |||
== Null 与 0 与 Undefined == | == Null 与 0 与 Undefined == | ||