Skip to content

Comment on Stop Using Constructors in JS (2012)

Comments

Here is the problem with Javascript.

Basically there is so many different ways to create objects that the only thing that matters is to actually document any piece of code.

Dont use constructors if you want.But somewhere you'll have to write "new FileReader" in the browser or "new XMLHttpRequest" because that's how an api you are consuming works!!!

Learn how javascript constructors and prototypes work,because you just CANT ignore them,wether you want it or not.

Truth is everybody wants to see what they wants to see in javascript.Some want to write pure Java like OOP,some think it looks like Haskell enough to try to write Haskell in Javascript. Javascript is no Java nor Haskell,one cant ignore one part of Javascript just because it looks "ugly" or whatever. Javascript is going to get classes and python like features and meta features like proxies. Javascript doesnt fit one paradigm, and never did.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.