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:
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31