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.
const obj = {firstName: 'Tyler'}; const protoObj = {lastName: 'Clark'}; Object.setPrototypeOf(obj, protoObj);
We can access the 'lastNmae' by calling:
obj.lastName
If we set:
obj.lastName = "Wan"
So now if we console.log obj.lastName it logs:
obj.lastName // Wan obj.__proto__.lastName //Clark
We we delete:
delete obj.lastName