

The one and only way to create JS objects - damienklinnert
https://gist.github.com/a2fd1da997f457b76efe

======
pan69
What's funny about this is that these techniques where already described in
2002 in the following book:

[http://www.amazon.com/Object-Oriented-Programming-
ActionScri...](http://www.amazon.com/Object-Oriented-Programming-ActionScript-
Branden-
Hall/dp/0735711836/ref=sr_1_1?ie=UTF8&qid=1353631530&sr=8-1&keywords=oop+with+actionscript)

I'm not proud of it but I did a lot Actionscript programming in those days and
I find it really interesting that these techniques are still totally valid for
Javascript.

~~~
damienklinnert
Many people tried different ways to create objects. All big frameworks come
with their own methods to do this. Some people use closures to create
inheritance.

I just tried to define which way seems to be the best one this days to follow.
I don't like to use all that frameworks for object systems. However, the most
important thing is the new 'class' feature in ECMAScript6.

------
beatgammit
Why do we need this?

The only thing "new" I see is returning `this` from setters, which I think is
pretty lame. I've never been of the jQuery way of chaining.

Also, there are several mistakes (as noted in the comments), most notably the
use of Object.create, which isn't supported in IE8 and below.

~~~
damienklinnert
Those issues are already fixed thanks to community work.

