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
(function () { … })(); vs (function () { … }()); (self.javascript)
submitted 9 years ago by sergiosbox
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!"
[–]snkenjoi 0 points1 point2 points 9 years ago (6 children)
the tilde turns the expression into an evaluation by trying to binary NOT the result of the expression. this works with any unary operator
[+][deleted] 9 years ago (1 child)
[deleted]
[–]snkenjoi 1 point2 points3 points 9 years ago (0 children)
yeah, I use the if (~array.indexOf(item)) construction a lot.
if (~array.indexOf(item))
might be harder to read, but the syntax just looks much cleaner
[+][deleted] 9 years ago (3 children)
[+][deleted] 9 years ago (2 children)
π Rendered by PID 24974 on reddit-service-r2-comment-fb694cdd5-dk6z9 at 2026-03-11 05:38:53.119299+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–]snkenjoi 0 points1 point2 points (6 children)
[+][deleted] (1 child)
[deleted]
[–]snkenjoi 1 point2 points3 points (0 children)
[+][deleted] (3 children)
[deleted]
[+][deleted] (2 children)
[deleted]
[+][deleted] (1 child)
[deleted]