Most of the cases Javascript permits us to omit a semicolon in the end of a statement. However, interestingly, not in this case:
var x = [5, 'asdf']
(function() {
window.alert("Yay!")
})()
This won't work, unless we put one semicolon in the end of the statement preceding the anon function:
var x = [5, 'asdf'];
(function() {
window.alert("Yay!")
})()
Now it works perfectly.
What obscure rule governing implied semicolons in the ends of statements prescribes that in this case this one semicolon is not implied?