This question is inspired from the accepted answer here. Why does the following piece of code alert "first", then "second", then errors out with a TypeError
?
(function() {
alert('first');
}())
(function() {
alert('second');
}())
The given explanation is that the returned value of the first function is trying to get called. But why did that happen? [Also, why didn't semi-colon insertion add a semi-colon after the first self-execution?]