The moment I lost it with JavaScript
The following code segments are from JavaScript Patterns by Stoyan Stefanou (O'Reilly 2010)
- 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.
<< Home