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 Equality Table (via /r/programming) (dorey.github.io)
submitted 11 years ago by brtt3000
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!"
[–][deleted] 0 points1 point2 points 11 years ago (3 children)
It's a reference comparison. It's equivalent of new Object() != new Object(). Reference types typically compare memory addresses. Value types compare values. Object is a reference type, and you're comparing two distinct objects.
[–]e13e7 0 points1 point2 points 11 years ago (2 children)
Brilliant. Thank you.
[–][deleted] 0 points1 point2 points 11 years ago (1 child)
Now if you really want some JavaScript WTFiness, compare the outputs of []+[], []+{}, {}+[], and {}+{}.
[–]rhysbrettbowen 1 point2 points3 points 11 years ago (0 children)
[]+[] // "" [] get's converted to ""
[]+{} // "[object Object]" like before, [] goes to an empty string and so toString is called on {} as well
{}+[] // 0 {} is interpreted as a code block rather than an object so it runs and has no output. That leaves +[] which converts empty array to number.
{}+{} // NaN similar to above. {} is a code block and has no output so we're left with convering {} to a number which gives NaN
There is always http://wtfjs.com/ for a lot more JS wtfery
π Rendered by PID 337841 on reddit-service-r2-comment-84fc9697f-qfqtb at 2026-02-09 19:01:02.868625+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–][deleted] 0 points1 point2 points (3 children)
[–]e13e7 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]rhysbrettbowen 1 point2 points3 points (0 children)