19

JS中的null和undefined,undefined为啥用void 0代替?

 4 years ago
source link: https://juejin.im/post/5cc58a72e51d456e845b4289
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
起因 某天,在看某位同学的js代码,代码中发现了一个奇怪的东西 void 0,虽然第一眼看不懂这是什么东西,但是根据上下文,这里应该是想判断是否等于undefined,为什么要这样写的,有什么渊源吗?顺便就把undefined和null都拿出来复习了一下.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK