r/javascript • • Dec 23 '18

JavaScript Fundamentals Every Beginners Should Know - ZeptoBook

https://www.zeptobook.com/javascript-fundamentals-every-beginners-should-know/
25 Upvotes

14 comments sorted by

View all comments

0

u/[deleted] Dec 23 '18

[deleted]

0

u/[deleted] Dec 23 '18

[deleted]

4

u/MoTTs_ Dec 23 '18

The behavior of prototypes and prototypal inheritance that we associate with JavaScript isn't as uncommon as we think. In both Python and Ruby, for example, classes are themselves objects, and inheritance is done by delegation.

Here's JavaScript and Python classes side-by-side, demonstrating classes as objects and inheritance as delegation.

And in fact, since Python's classes are themselves objects, you can even create objects ex-nilo. Here's JavaScript and Python ex-nilo object creation side-by-side

1

u/ClassyCamel Dec 23 '18

Love this evidence based stuff 👏