3 ms·
if ; (x3B?) and \n (x0A) are the same size, why use ; in minified JS if \n has more "features"
by gcb 14y ago
if ; (x3B?) and \n (x0A) are the same size, why use ; in minified JS if \n has more "features"
- deleted 14y ago[deleted]
- dave1010uk 14y agoSome reasons: \n can easily get turned into \r\n Whitespace is harder to see when debugging (especially with word wrap) Convention
- gcb 14y agoYou're not supposed to touch your minified js after you generated it
- dave1010uk 14y agoAnd most people won't. Using semicolons means things are less likely to break when other people use your code.
- philh 14y agoOn the input side, I would guess the problem is that the minifier in question uses a parse tree with a not-quite-perfect grammar. It sees clearMenus() !isActive && $parent.toggleClass('open') and parses it the same way it would have done clearMenus() !isActive && $parent.toggleClass('open') On the output side, using ; is simpler to program (A\nB only means A;B in some cases, depending on B). And you'll receive fewer flames for it.