javascript is based

I love javascript. To me it's the only scripting language with tolerable performance and compilation speed. Sadly a lot of people hold the opposite opinion. I'd like to look at some of the common criticisms of the language and DEBOONK them.
(Yes I'm calling it compilation speed. I don't care if your language is interpreting or generating bytecode or generating assembly or jitting. I just want it to run and it should run instantly. )

javascript is slow

Javascript is slow at some tasks that benefit greatly from data locality, wasm solves this problem. However any sane programmer will never run into performance problems writing GUIs in javascript (which is what it was made to do).

node_modules

yes. The "javascript ecosystem" is trash. Luckily you don't actually need any of those packages since browser API's are already very high level.

spyware

This is a browser/web standards problem, stop blaming javascript!
I personally like that the web is creating a standardized way to ship fully featured applications so in my opinion the best thing to do would be to create a browser that is very explicit about everything a page is doing and asks for user consent. So for example, visiting youtube would warn:

            This website wants to:
            - run code to modify its own page
            - share data with third parties [view list]
            - play video
            - play audio
            - store persistent user information

            [allow once] [allow forever]
        

Pages would specify these permissions in their header and not doing so would simply mean the browser stubs out the API's until the user manually turns them on. Browsers actually already do this but only for certain features like notifications/location tracking/audio recording.

equality meme

Duuurrrr why does []==''?!?!??!
Have you tried not writing spaghetti code?
The only one that is actually offensive is that NaN != NaN (And yeah that's DISGUSTING language design)

bizarro alien language design

Javascript used to be weird pre-es6, but in recent years it has started adopting more and more features commonly found in other languages.
Anyone familiar with python could already pick up old versions of javascript but now with class syntax it's also viable as a java-like scripting language.


I think those were most of the common criticisms of js. And as it turns out they are all trash!
So now I'd like to share some more of my own things that I like and dislike about the language.

Why javascript is actually bad

legacy features

Progress in language design should lead to better programming languages, but what actually ends up happening in the case of javascript is that trashy features stay in the language to ensure old pages don't break when a new feature gets added to javascript.
An example of this is function syntax which has mostly been replaced with lambda notation since these actually make the this keyword behave the way you'd think it would. However since classic functions are now abandonend you end up writing these bizarre const f = () => {} variable assignments instead of just function f() {} function declarations.
Other examles are the || mostly being replaced by ?? and class syntax mostly replacing function prototypes
I'd prefer if the language just updated and didn't care about legacy apps, browsers are already this brutal when it comes to messing with content policies.

missing features

Javascript should have these features:

bad standard library

The biggest problem with javascript.
It would benefit so much from just having small functions like Array.last.
And don't get me started on whatever garbage node.js came up with. code written in pure C99 is more concise than that verbose callback spaghetti. What were they thinking? This genuinely turns javascript from great scripting language to unusable for most tasks. Sad!

async/await

Controversial opinion alert!
Yeah I said it, async/await is trash (in javascript).
I do believe it has its place in lower level languages like Rust, but javascript is an event driven language. They should just lean into it and make every function async behind the scenes.
Stop bloating up my code with these keywords!
What really sucks is that some APIs will make you write code in a function that isn't async but you want to access another API that only provides an async interface. Hope you like like writing wrappers for no reason!

Why javascript is actually good

C-like syntax

I just can't get behind indentation based languages. Admittedly I haven't really used any of them a lot, but I just fail to see how they are better in any way. They introduce a whole bunch of problems without really solving any. Let's compare.

And then you have languages that aren't indentation sensitive but you type do end instead of { }, just why?
C obviously isn't perfect, but I still feel like it's by far the best language to base your syntax on. Having languages be C-like is also nice because it makes porting from and to other C-like languages a lot easier.

Fast

Already said this in the intro, but V8 is blazing fast and javascript being the language of browsers incentivises the team to keep it that way. And it's not even that bloated, the new V8-based javascript runtime Deno is a 31mb statically linked executable. All other scripting languages should be embarrased at how slow and bloated their runtime is compared to javascript.

Ergonomic

Destructuring, lambdas, template literals, decorators, accessors, spreads... There's just a ton if nice syntax features

Literally the future of computing

We'll eventually get to a point where browsers have access to all features a native app does, and that's a good thing! It will be the final solution to the cross platform computing problem.
People like to make fun of electron, but not too long from now we'll probably see operating systems provide a browser engine natively to write apps for. And just like that those bloated 200mb electron apps are now mere kilobytes in size! (Or realistically they will be a couple megabytes since web bloat is still a problem) It's a minimalists dream come true.

And on top of that Webassembly will solve the ongoing containerization pandemic! It's exciting times we live in, and it's sad that others don't want to see it.
It's also kind of funny when people like Jonathan Blow write off all "web technologies" as garbage only to then propose the exact system they just denounced.
"Cross platform computing should be solved with a tiny abstraction layer that that compiles to native machine code ahead of time, no jitting"
Yeah you just described Webassembly you boomer, congratulations!

Bonus rant: why typescript is trash

I've been writing a lot of typescript lately, and it seems to me like the consesus around it is that it's just a superior javascript because strong typing. I like strong typing but I feel like typscript took the wrong approach. It attempt to typecheck javascript which was designed from the ground up to abuse its dynamic nature. Not only does this make the typscript compiler incredibly slow (and justifyably so since it's solving a complex problem), it also fails to get the type right most of the time, so you need to manually insert casts all over the place. You'll inevitably end up writing your own abstractions that patch up the javascript weirdness and let you write nice clean typescript.

So doesn't that solve the issue? Well not really. If you're going to create a programming language on top of javascript it should be the language that solves javascript's issues, typescript does not do this. In fact, it introduces more. To make matters worse, typescript will never get good since adding features or libraries not present in javascript is one of the explicitly stated non-goals of the typescript language.

Don't get me wrong, I still use typescript because I believe any serious software should be strongly typed. I just don't believe it will be the right solution in the long run.