Echo JS 0.11.0

<~>
lipsmack 3822 days ago. link 1 point
Surely this is more of a misunderstanding about what `Backbone.Model.extend` actually does. I wouldn't necessarily call it "strange" behaviour.

When you extend a Backbone model, it adds the new properties to the class prototype. In the example, `myClass1` and `myClass2` share the same counter, but not for the reason that the author thinks. It's because they share a prototype chain. The fact that `counter` is an object is a red-herring; the same behaviour would occur if `counter` was a number.

Replies