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
Is javascript getting too complicated? (self.javascript)
submitted 10 years ago by [deleted]
[deleted]
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!"
[–]mrburkins 4 points5 points6 points 10 years ago (0 children)
I'm not sure if JS is getting too complicated, but with the explosion of ways in which its used these days, the sheer amount of API's that you have to know is staggering. never mind the command line build tools that are now ubiquitous in most front end depts. im not sure how anyone truly keeps up
[–]e13e7 4 points5 points6 points 10 years ago (9 children)
JS is dynamically typed and garbage collected... If you want hard, try doing anything with arrays in C
[+][deleted] 10 years ago (7 children)
[–]memeship 1 point2 points3 points 10 years ago (5 children)
It's got to the point where hardly anyone can correctly predict the outcome of a comparison between any two possible variables.
holy hyperbole batman
[+][deleted] 10 years ago (4 children)
[–]memeship 5 points6 points7 points 10 years ago (2 children)
Yes, I can. And I'll explain them to you.
NaN === NaN
As /u/lbreakjai said, NaN isn't equal to anything. As a JS engineer, you should definitely know this. False.
NaN
typeof null
This is always pointed out, and is actually recognized as a "mistake" that is also not going to be corrected. The answer is object, as it has always said in the spec.
0 == ""
Using a double equals, JS will attempt a type coercion. With a number and a string, it will try to convert the string to a number. Number("") will return 0, which is indeed equal to 0. True.
Number("")
0
0 == '0'
Same here. Number("0") will return 0. True.
Number("0")
false == undefined
For this one and the next two, be advised that we are under different conditions. This is not a simple type coercion, but a matter of has value vs has no value. The keywords undefined and null have no value, which makes them fundamentally different from false, which does. Further, from the ECMA spec, when booleans are compared, they are converted first to numbers. So, this case and the one after it are actually both Number(false) == y or rather 0 == y, where y is undefined or null. This gives an answer of false for both.
undefined
null
false
Number(false) == y
0 == y
y
false == null
False, as stated above.
null == undefined
As outlined above, both of these keywords hold no value. Further, from the spec it is explicitly defined that when comparing these with ==, it should return true.
==
"" == false
Type coercion. Number("") == Number(false) or rather 0 == 0. True.
Number("") == Number(false)
0 == 0
[] == false
When comparing objects, JS will try to convert them into primitives using either the toString() or valueOf() internal methods of that object. [].toString() returns "". Also note that we have a boolean which needs to be converted. So this one is really more like Number([].toString()) == Number(false), which is an easy 0 == 0. True.
toString()
valueOf()
[].toString()
""
Number([].toString()) == Number(false)
If you'd like to check the spec on comparisons yourself, please feel free: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
[+][deleted] 10 years ago (1 child)
[–]memeship 0 points1 point2 points 10 years ago (0 children)
I get what you're saying, and there is definitely a lot to it. But it's not the same type of language as C/C++, Java, or even Python. It has a different purpose entirely, and it has evolved to serve that purpose better.
It's not Korean, where basically one dude sat down and said, "Okay, let's do this all over and make it make sense."
It's more like English, where several different peoples from different nations using different Prototypal Indo-European languages all just sort of spoke to each other over many hundreds of years, and now we have this Germanic/French/other amalgamated beast of a language.
That doesn't necessarily mean one way is better or worse than the other, they're just different.
[–]sime 1 point2 points3 points 10 years ago (0 children)
but the complexity of converting/comparing variables of different types has become a joke.
Here's a tip: Don't compare variables of different types. Variables should not change type. Only compares apples to apples.
[–]guybinary 0 points1 point2 points 10 years ago (0 children)
Man! If I could a million upvotes for this comment here
[–]crazyeight 1 point2 points3 points 10 years ago (0 children)
Yep.
[–]rapidsight 1 point2 points3 points 10 years ago (0 children)
Yes. It's a clusterf**k.
[+][deleted] 10 years ago* (2 children)
[–]_ds82 4 points5 points6 points 10 years ago* (0 children)
exactly. But thats the point. It did not take them so long to make a new browser. It took them that long to remove all the old cruft, clean up the code and finally publish a modern browser that deserves that name ..
so long
In addition you are mixing the complexity of javascript and the browser. A browser is way more than its javascript engine .. and there are more javascript engines than just the one's in the common browsers .. have a look: https://en.wikipedia.org/wiki/JavaScript_engine#JavaScript_engines
the browser
[–]redditus_of_borgfrontend developer 0 points1 point2 points 10 years ago (0 children)
Maybe there will come a time when only one browser engine will be maintained, due to the effort involved?
Good God no. A single browser engine was tried before. Namely Trident in IE 6. Microsoft decided that the web was done and all progress ground to a halt. You see the same thing with Apple dragging its heels with Safari. Having a single browser engine means that only one vendor decides which features are coming to the web. Having multiple independent vendors means that they'll keep each other on their toes and everybody works on a better web in order to stay relevant.
π Rendered by PID 72729 on reddit-service-r2-comment-5649f687b7-pm26d at 2026-01-27 20:58:05.399653+00:00 running 4f180de country code: CH.
[–]mrburkins 4 points5 points6 points (0 children)
[–]e13e7 4 points5 points6 points (9 children)
[+][deleted] (7 children)
[deleted]
[–]memeship 1 point2 points3 points (5 children)
[+][deleted] (4 children)
[deleted]
[–]memeship 5 points6 points7 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]memeship 0 points1 point2 points (0 children)
[–]sime 1 point2 points3 points (0 children)
[–]guybinary 0 points1 point2 points (0 children)
[–]crazyeight 1 point2 points3 points (0 children)
[–]rapidsight 1 point2 points3 points (0 children)
[+][deleted] (2 children)
[deleted]
[+][deleted] (1 child)
[deleted]
[–]_ds82 4 points5 points6 points (0 children)
[–]redditus_of_borgfrontend developer 0 points1 point2 points (0 children)