Home > Article > Web Front-end > The shortest IE judgment code_javascript skills
Code:
var ie = ! "v1";
Only 7bytes required! See this article, "32 bytes, ehr ... 9, ehr ... 7!!! to know if your browser is IE", which tells how foreigners change the judgment of IE from 32 bytes The story of reducing it to 7 bytes step by step
But this record was broken by a Russian on January 8 this year, and now it is only 6 bytes! It takes advantage of the difference between IE and standard browsers in the toString method of processing arrays. It's done. For standard browsers, if the last character in the array is a comma, the JS engine will automatically remove it.
Code: