What does HackerNews think of wtfjs?
🤪 A list of funny and tricky JavaScript examples
https://news.ycombinator.com/item?id=1121932
https://github.com/denysdovhan/wtfjs
My my, how HN sensibilities change over time. Hacker news, the place where the language police now rains supreme eh?
JavaScript is strongly-typed though, it just lacks a way to declare types. One can easily restrict types in script code (using `typeof` for primitives and `instanceof` for object prototypes).
People refer to it as "weakly-typed" because most (but not all) of the built-in types have implicit conversions to other types; and many of which are non-obvious: https://github.com/denysdovhan/wtfjs
The author also trots out the standard go-to argument of JavaScript haters. He writes that JavaScript "has deeply ingrained quirks and bugs which can never be fixed without breaking the millions of scripts that have made peace with the existence of those bugs and depend upon the well-known workaround" and he links to https://github.com/denysdovhan/wtfjs, a typical list of JavaScript's well-known type-casting quirks, etc.
Pretty much all languages have little quirks. Actual JavaScript programmers usually learn how to avoid JavaScript's quirks pretty quickly and easily. In my experience, people who fixate on JavaScript's quirks generally do not understand the language very well. If they did, they could criticize more substantial things about JavaScript than just things like "[] == ![]; // -> true".
https://github.com/denysdovhan/wtfjs
Or it's slightly older brother "WTF, Python?"
Not so with webdev. That said, the source code is there for all of us to read. I'm a frontend developer and spend more time looking at source code when I need to figure out an issue than digging through Medium posts. Particularly when something is behaving in an unexpected manner.
I'd urge everyone who hates webdev to try this approach the next time they struggle with an issue. JavaScript, for all its sins, is fairly easy to read. And once you've understood the ~30 most common gotchas in JS, reading the source is highly beneficial (and here's a good intro to those gotchas, including an accompanying video: https://github.com/denysdovhan/wtfjs)
Or better yet, work in one of the statically-typed compile-to-JS languages such as Typescript, ReasonML, Elm, ScalaJS, or Purescript and worry about those gotchas much less (and only when wrapping external libraries).
It's definitely something that's difficult with building a language. Abstracting and generalizing your language parser can lead to amigious behavior.
Arch is an early stage NYC-based, Fintech startup in the alternative investment industry with paying customers. Our engineering team is a couple of MIT alums who were previously early engineers at successful startups that have since IPO'd. We are being advised by a founder/investor with two successful exits (who was also the eighth user of Dropbox).
We're looking to grow our three person team. Contact us if:
- Your favorite fruit in JavaScript is ('b' + 'a' + + 'a' + 'a') (Arch does not discriminate against apple or orange lovers)
- You think https://github.com/denysdovhan/wtfjs is interesting, but looks nothing like your code
Fullstack - https://angel.co/arch-4/jobs/375451-senior-full-stack-engine...
Frontend - https://angel.co/arch-4/jobs/375452-senior-front-end-enginee...
Apply above or reach out to [email protected]
No, JS shouldn't be used as a systems language IMO. It gives you enough rope to shoot yourself in the foot (multiple mixed metaphors for a reason).
[1] https://charlieharvey.org.uk/page/javascript_the_weird_parts
I agree with others though that you probably won't get the trivia treatment, I wouldn't give one and I don't see them being done by coworkers... But it doesn't hurt to be prepared. So long as you don't present yourself as a "Master" I would think the knives would be less likely to come out. Things like this github has https://github.com/denysdovhan/wtfjs are on the mean spectrum to use against some so-called master, the meanest might probably be demanding they do something with representations like in http://patriciopalladino.com/blog/2012/08/09/non-alphanumeri...