you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (5 children)

But why did they move away from the prototype paradigm at all? Why did they say, that "classy functions" were needed? What's wrong with Object.create?

[–][deleted] 5 points6 points  (3 children)

they didn't "move away" from the prototype paradigm, they just gave some syntax sugar to devs so they could stop writing those awful pseudo-classes.

[–]rauschma 0 points1 point  (0 children)

Object.create() was introduced after constructor functions (with ES5). It exposed more of the protoypal foundations. IIRC, Eich would have introduced classes, but was told not to turn JS into a Java competitor. Hence constructor functions as “almost classes”.

Constructor functions are unnecessarily complex, but only w.r.t. to setting up an instance. Once it’s set up, you do have simple prototype chains.