re: Emulating "Private" Variables in JavaScript with Closures and Factory Functions VIEW POST

re: The one place where I never particularly liked this method personally is where the type of the object is also relevant - with your factory, each ob...

I like how clever this is. Surely, this has its uses, but for me, it's too much of a price to pay just to enable inheritance. It's one big soup of JavaScript obscurities (like how classes can be passed in as arguments to a function). I can imagine in my head how a traditional object-oriented developer would look at this and be like, "WHAT IS THIS??? JAVASCRIPT IS A HORRIBLE LANGUAGE!"


It depends on how important inheritance is for your use case. And while I haven't gone looking, I bet the Babel plugin for #name likely does much the same thing.

Code of Conduct Report abuse