Hacker News new | ask | show | jobs
by kofman 5005 days ago
Agreed, it's a terrible language. Among other things, it makes it way too easy to write code which many people will read as being correct, but will actually be subtly incorrect.

A few of the weakest parts:

- for (var x in y) when used for array iteration or even dict iteration; hasOwnProperty? Really?

- x[obj] = y; seriously, did i really want '[Object object]' as my key?

- the choice of function level scope over block level scope

2 comments

I'm not sure function level scope over block level is a bad thing. It makes it more Lisp-y. And if you want block level scope, it's about as easy as (in CoffeeScript):

    do ->
        ... local variables right here ...
> I'm not sure function level scope over block level is a bad thing. It makes it more Lisp-y.

Lisp has block scope.

Well, it can have both...
Example?

Can you write Lisp like this?

Function for(){ f(x); var x = 2; }

Compiles and runs with f(undefined)

It might be nice to make a canonical list of things which suck about JavaScript.

https://hackpad.com/spTEgxqvFYj#Things-That-Suck-About-JavaS...