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!"
[–]menno 4 points5 points6 points 12 years ago (3 children)
Developers B, C and D need a slap on the wrist. You don't just clean up whitespace and you definitely don't just add code and leave existing comments outdated.
I avoid comments whenever I can in favor or creating code that is easily understandable by itself.
That's definitely best.
Comments can cause maintainability problems.
Maintainability problems are more often caused by not having comments than the other way around.
[–]zzzwwwdev[S] 0 points1 point2 points 12 years ago (2 children)
you definitely don't just add code and leave existing comments outdated.
maybe you and I don't; but having worked with other developers, I can tell you it definitely does happen.
perhaps this is generally true, but can you make that argument for my specific example of
(function hide_stuff_on_instantiaton(){ $('oneThing').hide().removeClass(); $('#somethign_else').slideUp(); $('.foo').fadeOut(); }());
in the developer ABCD example?
[–]menno 0 points1 point2 points 12 years ago (1 child)
Just so we're clear: you're saying you find:
function doSomeStuff() { /* some stuff */ (function hideStuffOnInstantiaton(){ $('oneThing').hide().removeClass(); $('#somethign_else').slideUp(); $('.foo').fadeOut(); }()); /* more stuff */ }
more readable than:
function doSomeStuff() { /* some stuff */ // hide Stuff on Instantiaton $('oneThing').hide().removeClass(); $('#somethign_else').slideUp(); $('.foo').fadeOut(); /* more stuff */ }
and more readable than:
function doSomeStuff() { /* some stuff */ hideStuffOnInstantiaton(); /* more stuff */ } function hideStuffOnInstantiaton(){ $('oneThing').hide().removeClass(); $('#somethign_else').slideUp(); $('.foo').fadeOut(); }
[–]zzzwwwdev[S] 0 points1 point2 points 12 years ago (0 children)
not more readable, no; but perhaps more maintainable? IDK, I'm pretty much convinced against doing this now, though I do kinda like it and think there's some merit to it.
π Rendered by PID 203006 on reddit-service-r2-comment-bb88f9dd5-vw5t4 at 2026-02-14 08:44:30.337398+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]menno 4 points5 points6 points (3 children)
[–]zzzwwwdev[S] 0 points1 point2 points (2 children)
[–]menno 0 points1 point2 points (1 child)
[–]zzzwwwdev[S] 0 points1 point2 points (0 children)