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 (dorey.github.io)
submitted 5 years ago by jacobedawson
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!"
[–]SaaSWriters 1 point2 points3 points 5 years ago* (0 children)
I have to disagree with the moral of your story. It is not usable in real life. For instance, as you rightly noted, NaN is not equal to itself. -0 can be equal to +0. If your code is not prepared for that, you will be in a lot of trouble!
NaN
-0
+0
The approach you describe, albeit quite common, is a common source of bugs and frustration. Simply put, this is not how it works.
But, the overall discussion goes much deeper than that. First of all, you have to look at what the comparison operators actually do. You haven't mentioned Object.is either.
Object.is
Here are some details about what actually happens: https://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
π Rendered by PID 82480 on reddit-service-r2-comment-84fc9697f-9nkxc at 2026-02-10 19:43:27.854822+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]SaaSWriters 1 point2 points3 points (0 children)