- Can you spot the difference?
- Which one is correct JavaScript?
- If both are correct, what is the difference in behaviour?
(function() {
alert( "An immediate function");
}());
(function() {
alert( "Also an immediate function");
})();
The answers are
- The position of brackets in the last line
- Both are correct
- There is no difference
At this point I throw the book across the room. Not that it's the book's fault.