[1, 2, 3].forEach( ... )
(function(){ ... })()
Statements like that are virtually always errors under ASI, but if you avoid them nothing else causes problems.https://news.ycombinator.com/item?id=3842713
https://github.com/twbs/bootstrap/issues/3057
And don't forget to semicolon-harden your most important mission-critical code:
https://www.bluejava.com/4PN/Semicolons-in-JavaScript---The-...
;;;;;;;;;;;; // protective wall of semicolons
;;var a = 10, b = 20;;
;;
;;function add(a,b)
;;{;;
;;return a + b;;;;;;;; // this function MUST work
;;};;
;;;;;;;;;;;; // protective wall of semicolons var a = []
var b = ''
var c = {}
[].concat.apply(a, [b, c]) return
false
Where the program returns undefined. I can only think of these examples as straw men. Not once did I run in to an ASI bug. foo=arr[i]
(counter++)(That said: if you use someone else’s code, putting up with their style is part of the bargain, even if I think leaving out semicolons is pointless aesthetic bikeshedding.)
Bikeshedding isn't when you paint the bikeshed your favorite color, it's the bickering over the shade it should be painted which is actually what you did, especially since the damage has already been done. ;)
This whole thread is insufferable bikeshedding.