2014-05-13

Understanding the four layers of JavaScript OOP

JavaScript OOP is baffling: on one hand, there is a simple core, on the other hand, there are some really weird things going on. I’ve been pondering for a long time how to explain it well and I think the best way to do so is via four layers: single objects, prototype chains, constructors, constructor inheritance. The first two layers are JavaScript’s simple OOP core, layers 3 and 4 are where the complications start.

The four layers of JavaScript OOP.

I’ve explained the four OOP layers in an O’Reilly webcast:

Additional material:

No comments: