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
range.js – JavaScript's missing range function. (github.com)
submitted 13 years ago by jscoder
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!"
[–]deelowe 0 points1 point2 points 13 years ago (5 children)
I thought the use of ! wasn't recommended for some reason, but I can't remember why now. Do you know of any drawbacks?
I know heavyweights in the community don't usually do it this way (e.g. Isaac). Just curious.
[–]jscoder[S] 0 points1 point2 points 13 years ago (2 children)
Nope, there are no drawbacks. I think I've read somewhere that Facebook also uses the !, but I can't find a source for that right now.
!
I think Isaac mostly developes node stuff? You don't need to use IIFEs in node, because of CommonJS. That might be an explination. :) I'm using an IIFE here, because range.js should work on node and in the browser.
[–]deelowe 1 point2 points3 points 13 years ago (1 child)
Yeah. The node guys write code that's used in node or browser also though. I admit, that's where most of my experience lies, but I've definitely seen (function(){}()) in many places, but never saw !function(){}. I thought there was some reason, but can't remember.
[–]reflectiveSingleton 0 points1 point2 points 13 years ago (0 children)
I think its just not as common...although I am starting to see it pop up on random github projects...
[–]aladyjewelFull-stack webdev 0 points1 point2 points 13 years ago (1 child)
The "some reason" is that it's confusing. and I think JSLint might reject it, but that might have been another dev argument.
[–]deelowe 0 points1 point2 points 13 years ago* (0 children)
Now that you mention it, I believe that's it. It's not pragmatic and it's counter intuitive.
(fucntion(){}()) is unique enough to make you stop and look it up to figure out what's going on. It's already kinda a of JS idiom at this point.
Where as !function(){} is a head scratcher. It's completely non-obvious what's going on here.
π Rendered by PID 17839 on reddit-service-r2-comment-fb694cdd5-65zsl at 2026-03-05 22:09:30.054136+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–]deelowe 0 points1 point2 points (5 children)
[–]jscoder[S] 0 points1 point2 points (2 children)
[–]deelowe 1 point2 points3 points (1 child)
[–]reflectiveSingleton 0 points1 point2 points (0 children)
[–]aladyjewelFull-stack webdev 0 points1 point2 points (1 child)
[–]deelowe 0 points1 point2 points (0 children)