Live data from Hacker News

JavaScript Is Weird

jsisweird.com

21–30 of 383 posts

Re: JavaScript Is Weird

#21
This covers most of the weirdness with primitive types, but then we have an oddly designed OO system on top of that: prototypes + `this` and constructors + classes bolted on.

Re: JavaScript Is Weird

#22
post #16

> JavaScript is a great programming language, but ... Why are we so afraid to call trash "trash"? It's not attacking the creator, but just how can we make progress if things are not perceived as they are? https://wtfjs.com

Loved this video (4mins) of a talk by Gary Bernhardt (CodeMash 2012) on the topic of JS' quirks: https://www.destroyallsoftware.com/talks/wat

Yep, the "wat" talk helped, got 17/25 first try since I recalled some of the weirdness.

Re: JavaScript Is Weird

#25

> JavaScript is a great programming language, but ... Why are we so afraid to call trash "trash"? It's not attacking the creator, but just how can we make progress if things are not perceived as they are? https://wtfjs.com

The vast majority of these are implicit type coercion issues. Which is fairly easily banned with a linter. Once you've done that, I think JavaScript is probably the nicest of the big dynamic scripting languages (Perl, PHP, Python, Ruby) to work with.

There could definitely be improvements, but trash seems to be taking things too far.

Re: JavaScript Is Weird

#26
post #15

> JavaScript is a great programming language, but ... Why are we so afraid to call trash "trash"? It's not attacking the creator, but just how can we make progress if things are not perceived as they are? https://wtfjs.com

Trash is something you are discarding. If you are keeping it because it still has some utility to you, then it is by definition not trash.

That's only one of multiple equally valid definitions.

Re: JavaScript Is Weird

#27
post #19

0.2 + 0.1 === 0.3 That's not really a JS problem, that's a floating point problem. Plenty of languages will have the same issue. +!![] "" - - "" (null - 0) + "0" Calling these things weird is fair enough but I can't help thinking this is code you'd never actually write outside of the context of a "Look how weird JS is!" post. It's like picking examples from the Annual Obfuscated C Contest to show how hard it is to un…

Yup, garbage in garbage out. I'm not a huge fan of JS, but this sort of criticism is absurd.

Re: JavaScript Is Weird

#29
Yes Javascript is weird but at the same time you almost never face many of these issues in the real world. Bad things exist in all languages, for some maybe there isn't the same in the sense of actual quirks in the language but rather other things that limit the language in some way.

I have been a web dev for about 10 years now and I rarely if ever run into these issues. More likely, I face issues and bugs regarding state and just flaws in the logic rather than issues based on that the language wasn't designed so great.

For sure this can be worrying if you do something really important but at the same time you have a lot of other languages to choose from.

Re: JavaScript Is Weird

#30
post #19

0.2 + 0.1 === 0.3 That's not really a JS problem, that's a floating point problem. Plenty of languages will have the same issue. +!![] "" - - "" (null - 0) + "0" Calling these things weird is fair enough but I can't help thinking this is code you'd never actually write outside of the context of a "Look how weird JS is!" post. It's like picking examples from the Annual Obfuscated C Contest to show how hard it is to un…

Exactly. Finding flaws in a language doesn't mean the language is bad, just that it has... flaws. The proof that JS is actually pretty good is that it has been used to build so many things. Like the old adage about economics, these criticisms are taking something that works in practice and trying to see if it works in theory.
Post reply on HN