DEV Community

Cover image for JavaScript - The prototype chain in depth

JavaScript - The prototype chain in depth

Sagiv ben giat on November 09, 2019

Learn the concept of inheritance with the prototype chain Originally posted at my personal blog debuggr.io In this article we will lear...
Collapse
 
karataev profile image
Eugene Karataev

Thanks for the great post. I like your way of explaining things step by step and how you go from low-level details like prototypes to abstractions like class. It shows that there is no black magic under the hood, just language constructions to make a dev's life easier.

Collapse
 
sag1v profile image
Sagiv ben giat

Thanks for the feedback, im so glad you liked it 🙃

Collapse
 
apisurfer profile image
Luka Vidaković • Edited

Awesome post! It's perhaps the best I've read about prototypal inheritance. Even better than some 40min or so videos trying to explain this. You are really good at decomposing something complex into small and explainable steps 👍. This will probably remain in my bookmarks as a go to reference I'll share with anyone that wants to understand classes under the hood and more. Low-level prototypal approach offers more control and flexibility but comes at a greater responsibility and more risk :).
I'm looking forward to reading your future posts!

Collapse
 
sag1v profile image
Sagiv ben giat

wow, thanks for the awesome feedback! I'm so glad you find it useful. You can subscribe to my blog to get notified when a new post is released debuggr.io 🤓

Collapse
 
apisurfer profile image
Luka Vidaković

Will do 👌

Collapse
 
pan463859 profile image
Grizzly

can i translate this article to Chinese and share it with my friends?

Collapse
 
sag1v profile image
Sagiv ben giat

Yeah sure, maybe link it to mine to keep the context

Collapse
 
pan463859 profile image
Grizzly

of course i will,thanks

Collapse
 
pan463859 profile image
Grizzly

In section named Constructor Functions - Sub Classing,first code segment,has a unnessary statement paidPlayerFunctions ~

Thread Thread
 
sag1v profile image
Sagiv ben giat

Thank you! removed. :)

Thread Thread
 
pan463859 profile image
Grizzly

segmentfault.com/a/1190000021080774
this article's Chinese version~ haha

Collapse
 
kioviensis profile image
Max Tarsis

Awesome job, I really liked it! :)

if you do not mind, I would also recommend adding the use of object.assign and object spread (with their features) as an alternative for Object.create and Object.setPrototypeOf.

But yeah, in general, what you wrote should be enough.

Collapse
 
sag1v profile image
Sagiv ben giat

Thanks for the great feedback Max, though i'm not sure i follow regarding the Object.assign mention. AFAIK, it doesn't have anything to do with manipulating the proto chain.

Collapse
 
vagoel profile image
Varun

What a great post ,you churned down all the inheritance complexities into simple steps which are very easy to understand.

Collapse
 
sag1v profile image
Sagiv ben giat

Thank you, im glad you liked it 🙂

Collapse
 
mofopeojosh profile image
Mofope Ojosh

This was very useful. Thanks.

Collapse
 
pan463859 profile image
Grizzly

mark first~