Live data from Hacker News

JavaScript Is Weird

jsisweird.com

11–20 of 383 posts

Re: JavaScript Is Weird

#12

> 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

I thought the same thing. I think the author is afraid of offending people. Downvote culture has conditioned a lot of people to walk on eggshells and write this way.

Re: JavaScript Is Weird

#13
I use JS since almost a decade and only got half of them right. Specifically I failed at the last one because I got impatient, the octal one got me too (never use those in JS), the true++ and the ones that require you to know that arrays are converted to strings when used in arithmetic.

I'll just externalize my embarrassment and say that JS is indeed weird! Another excuse is that I typically try to avoid implicit type conversion except for idiomatic "tricks" such as using !! to convert to a boolean.

Cool website though!

Re: JavaScript Is Weird

#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.

Re: JavaScript Is Weird

#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

Re: JavaScript Is Weird

#17
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.

So I think we should interpret "trash" here as "badly designed".

Re: JavaScript Is Weird

#18

Especially weird was that the quiz stuck at question 2 and kept resizing and shifting the position of the question text on selecting any answer until the quiz ended. CSS in the console is a nice touch though.

> CSS in the console is a nice touch though.

Ty for bringing it to attention. Indeed a cool feature to create emphasis and structure. Haven't bothered with it yet but will consider it. Another cool one is using console.groupCollapsed (as long as you are staying in a callback context).

Re: JavaScript Is Weird

#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 understand C. Yes, some languages enable you to write weird garbage code that's hard to reason about, and ideally they wouldn't because enforcing sane code would be great, but come on. Most of these things aren't a big problem that we suffer every day. Just be moderately careful about casting things from one data type to another and all these problems go away.

Re: JavaScript Is Weird

#20

> 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

Is javascript any more "trash" than python or ruby? I don't think so.
Post reply on HN