forked from subtleGradient/slick
-
Notifications
You must be signed in to change notification settings - Fork 20
IIFE
subtleGradient edited this page Feb 16, 2011
·
7 revisions
1 + 1 // lol, math
// Yay, comments
(function(){ /* Teh Codez */ }())
1 + 1 // lol, math
// Yay, comments
(function(){ /* Teh Codez */ }())
Result: TypeError: number is not a function
;(function(){ /* Teh Codez */ }())
Semicolon FTW
1 + 1; // lol, math
Obviously you could simply add a semicolon to the first file instead of the second. But the problem with that approach is that the people who control File2.js (i.e. the Slick project) have absolutely no control over File1.js. It may be ugly and not ideal, but adding a single harmless character to File2.js solves a potentially difficult to debug issue.