Link to Other Objects through the JavaScript Prototype Chain

InstructorTyler Clark

Share this video with your friends

Send Tweet

Objects have the ability to use data and methods that other objects contain, as long as it lives on the [[prototype]] chain. In this lesson we’ll test this out by adding properties and working with this linkage of properties.

Marta Kavrukova
~ 6 years ago

What editor are you using?

Tony Colston
~ 6 years ago

Yes yes what editor? It looks like it is evaluating on the fly...

Alexander Zubko
~ 6 years ago

The editor that the author is using is VS Code for sure. And for the live editing features I believe he is using this extension: https://marketplace.visualstudio.com/items?itemName=WallabyJs.quokka-vscode

Tony Colston
~ 6 years ago

Thanks! that looks like it is it.

Tyler Clarkinstructor
~ 6 years ago

Yes, that is correct Alexander. Also, you'll need to pay for a license to use it.

Tyler Clarkinstructor
~ 6 years ago
Alexander Zubko
~ 6 years ago

Thanks for the confirmation Tyler. Maybe smth has changed in this space. As of now there is a community edition with limited features, but it's still pretty awesome! Great find, thx for using it in the course! :)

Marta Kavrukova
~ 6 years ago

Thanks, that is awesome. Enjoyed the course as well :)

Tyler Clarkinstructor
~ 6 years ago

Awesome! Glad you liked it!

Eugene Vedensky
~ 6 years ago

Why do we use Object.sertPrototypeOf( ... ) rather than directly mutating our targets proto property?

for example,

const obj = { firstName: 'Tyler' } const protoObj = { lastName: 'Clark' }

obj.proto= protoObj;

Same effect, right? I do recognize we'll have to manually reset the constructor in an actual inheritance chain with this method, however.

Dylan Punchihewa
~ 6 years ago

@Tyler When you create an object (putting it into the meomary) does it also create all the other objects that's reference via the proto property so that the initial object have access to all the properties of proto objects?