What does "- [1,]" mean "if (! - [1,] &&! Window.XMLHttpRequest)"?

I find the code below, but I do not understand this.

if (!-[1, ] && !window.XMLHttpRequest) {
    document.execCommand("BackgroundImageCache", false, true);
}

What does it mean if(!-[1,])? Thanks

+5
source share
3 answers

This is a hack to detect the old Internet Explorer. -[1,] -1in modern browsers (so falsec !), but NaNin old IE ( truedenied). The first version returning the correct result is IE9.

+6
source

This exact code will never give anything but false, therefore, it is meaningless as introduced. I assume this is a visualized output and that depending on some serveride variable, sometimes something else may be.

, window.XMLHttpRequest, , . [1,] , - Chrome Internet Explorer. Chrome , , IE , , .

-[1,0] NaN . -[1] -1 . , -[1,] NaN IE (, , ), -1 ( ).

. .

, window.XMLHttpRequest, , - .

+4

:

-[1, ] -1.

!-[1, ] .

[] , , , - NaN.

0
source

All Articles