JavaScript/typeof:修订间差异
来自康健生活
创建页面,内容为“<syntaxhighlight lang="javascript"> typeof undefined; // ==> undefined typeof null; // ==> object(历史问题)</syntaxhighlight> == undefined 和 null == <syntaxhig…” |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
<syntaxhighlight lang="javascript"> | {{Leftrightflex|<syntaxhighlight lang="javascript"> | ||
typeof undefined; | typeof undefined; | ||
typeof null;</syntaxhighlight> | |||
typeof null; | |{{Consoleout|<pre>undefined | ||
object(历史问题) | |||
</pre>}} | |||
}} | |||
== undefined 和 null == | == undefined 和 null == | ||
<syntaxhighlight lang="javascript"> | {{Leftrightflex|<syntaxhighlight lang="javascript"> | ||
undefined == null; | undefined == null; | ||
undefined === null; | undefined === null; | ||
Number(undefined); | Number(undefined); | ||
Number(null);</syntaxhighlight> | |||
Number(null); | |{{Consoleout|<pre>true | ||
false | |||
NaN | |||
0</pre>}} | |||
}} | |||
2020年6月2日 (二) 07:44的版本
No categories