I have found this piece of code in jQuery Migrate v1.1.1
jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){/* anything */}
And I really wonder about 2 things:
1) What does ===void 0
mean?
2) Why these conditions are followed by a comma? My tests showed me it will always get executed.
Its just not I really need to know,but i am really interested, because I thought I knew everything about JS. ;)
void 0
will yield undefined
, as will void X
for any X
; it is shorter, and cannot get redefined like undefined
can. So ===void 0
compares jQuery.migrateMute
with undefined
.
!0
is true
.
Thus, the "translation" of jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0)
is:
if (jQuery.migrateMute === undefined) {
jQuery.migrateMute = true;
}
Then the stuff after the comma executes, independently from this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With