The world's shortest Javascript method to determine IE browser comes from Russia! It has been tested on various versions of IE and other currently popular browsers. Although Microsoft has been aware of IE-based bugs, it has never corrected them.
The above code running result: return true under IE, other standards The browser returns false. !-[1,], only 6 bytes!
But if you judge the other way around, if the standard browser returns true and IE returns false, you can shorten it by one byte.
After reading this, are you curious about how these work? Please continue reading below.
The reason for this bug is that IE will add an empty array element to the total number of array elements.
[1,]. Length standard browser will return 1 (based on standard ECMAscript, the comma "," at the end of the array will be ignored, this is to facilitate display in a column and automatic generation, etc.), but IE will Return 2. When you print this array IE will return "1, ", which is two elements, while other standard browsers will return "1".
This is easy to verify, such as running the following code in IE and FF: