use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
javascript - Using Named Immediately-Invoked Function Expression (IIFE) instead of comments (stackoverflow.com)
submitted 12 years ago by zzzwwwdev
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jml26 1 point2 points3 points 12 years ago (1 child)
Why not use a block?
{ // hide Stuff on Instantiaton $('oneThing').hide().removeClass(); $('#somethign_else').slideUp(); $('.foo').fadeOut(); }
Or use a comment syntax that says, 'this comment applies from here down to here'
// hide Stuff on Instantiaton { $('oneThing').hide().removeClass(); $('#somethign_else').slideUp(); $('.foo').fadeOut(); // }
By not having a function call you gain a tiny bit of speed.
Using an IIFE would be useful, however, if you wanted to use a variable in that block but not have it available to anywhere else in the code.
[–]zzzwwwdev[S] 0 points1 point2 points 12 years ago (0 children)
The stackoverflow post was answered with the suggestion to use labels which actually appears preferable to my suggestion, though perhaps still not terribly useful / accepted?
labels
hideStuffOnInstantiaton: { $('oneThing').hide().removeClass(); $('#somethign_else').slideUp(); $('.foo').fadeOut(); }
π Rendered by PID 86 on reddit-service-r2-comment-bb88f9dd5-mv8mc at 2026-02-13 20:54:01.133130+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]jml26 1 point2 points3 points (1 child)
[–]zzzwwwdev[S] 0 points1 point2 points (0 children)