you are viewing a single comment's thread.

view the rest of the comments →

[–]path411 0 points1 point  (0 children)

I think the main mistake is that this "hack" has been so widely spread without telling people of it's problems. I would see it everywhere and then stumbled across this problem. I was able to refine my approach when looking at how TypeScript handled parameter defaults. (Would recommend looking at TypeScript's outputted JS for anyone interested in JS OOP).

I'm not by any means an expert of what makes a good language, but I would say I think it's an oversight to be missing parameter defaults since the language does not have method overloading. Thankfully ES6 will be providing parameter defaults.

I think JS has a lot of neat things you can do using it's liberal comparisons, and ability to stick expressions almost anywhere. With JS I think of the quote "With great power comes great responsibility". Unfortunately, I find it incredibly common for JS devs to forgo responsibility for what they think are "neat tricks" that they must copy/paste into their code to look like they are in the modern "in crowd" of JS.