Created
June 22, 2011 10:32
-
-
Save petrosalema/1039841 to your computer and use it in GitHub Desktop.
I think it should be best practice to name immediately invoked functions (often anonymous), here's why...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Execute this and look at your console errors. | |
// this ... | |
(function __I_HAVE_A_NAME_NOW__ () { | |
// deliberate error | |
catchMeIfYouCan(); | |
})(); | |
// ... debugs far better this anonymous function | |
(function /* __I_HAVE_A_NAME_NOW__ */ () { | |
// deliberate error | |
catchMeIfYouCan(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment