Ask HN: What do you enjoy about JavaScript?
I don't find JavaScript fun to work with. I love Chromes debugging tools and realize it a hugely valuable language but I don't find it fun.
There are people that love JS and want to use it for everything. If you're one of them what makes it fun?
30 comments
[ 5.4 ms ] story [ 72.4 ms ] threadIt's just a tool get something done. For me JS fails silently far too often and is burdened by DOM + CSS + frameworks with their own quirks.
JS is useful for some situations and the worst possible choice in others. That's why we have lots of PLs to chose from. Just like hardware stores don't just sell hammers.
I like to understand what draws different people to different things.
I have fun with F# because it's like a puzzle that just works once you get the pieces to fit.
I hate Perl while others love it. I find it fascinating to discuss what brings someone to get joy out of a tool.
Why would anyone want to write in a verbose language that can't get things done through natural human thinking?
Most languages are acceptable in that regard, so maybe you don't care.
I love these and find them very powerful, but it's probably a bit like extroverts vs introverts -- totally dependent on your character.
It can be used to solve legitimate computational problems, whether you enjoy coding it or not.
Having an asynchronous model but a with single thread is also something I like about javascript. It provides good enough performances for most use cases without requiring to think about synchronizing between threads. The async/await model is much simpler to use compared to Golang or Rust for example, while it is a lot less powerful of course. You can also use more than one process but it's usually a good sign that you should use something else than JavaScript for the task.
I also like the tooling, you have a lot of great things on npm. A lot of terrible things too and you shouldn't install whatever you find on npm. In general the community is very nice and JavaScript doesn't have a lot of enterprise crap with overly complicated design patterns.
It's of course not perfect, but I think it's one of the best programming languages at this time.
Typescript seems like a genuine improvement but I am too lazy to learn it properly.
http://www.jsfuck.com/
Always thinking asynchronously means your less likely to create synchronous render-blocking code which sucks for users.
Also the npm ecosystem and tooling is very easy to work with and easy to understand (everything is under node_modules not some globally installed binary)
It's great for small projects and websites, but anything that requires performance would probably be better in a compiled language.
This has been such a mistake, now it needs "await" all over the code.
Programs run synchronously and only needs to go async every once in a while but things get pretty verbose from it.
Await is just a syntactic sugar, and quite a good one I think. You need to seperate async and sync functions somehow in order to prevent code from blocking the main thread.
> Programs run synchronously and only needs to go async every once in a while but things get pretty verbose from it.
Well I would argue that most things a program does (besides crunching raw data within memory) is asynchronous. Network requests, painting to screen, polling IO ports, fetching from the Filesystem, handling user interaction... these are all examples of asynchronous operations.
It's simpler to have a single-threaded event-loop rather than spinning up threads and keep track of them, preventing deadlocking etc...
A single-threaded event-loop also has the benefit of being incapable of dead-locking, as only one thread is accessing variables at any given point.
I love it is asynchronous by default (and thus all its ecosystem is as well). As someone that had to deal a lot with thread pools, and semaphores and concurrency issues, this is invaluable to me.
I also like a lot the tooling. From VSCode support, to typescript, to eslint, prettier and despite people complain about large node_modules, I think NPM and the trade offs leading to that are very worth it.
I also really enjoy the availability of libraries... whatever you need, you'll find a popular package for it.
It’s a great place to start for many tasks. When things get slow or it’s not the right tool for the task, then it’s time to switch that piece to Go or Rust.