12

#JavaScript xxx === void 0 是什么意思?

 1 year ago
source link: https://xmanyou.com/javascript-what-does-void-0-mean/
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.
24 September 2021 / JavaScript

#JavaScript xxx === void 0 是什么意思?

判断一个变量是否undefined的一种做法是:

if( typeof(xxx) === "undefined" ){
    // xxx undefined
}

还有一种写法是:

if( xxx === void 0 ){
    // xxx undefined
}

阿斌

Read more posts by this author.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK