Loading topic
obj.prop, where does the engine look for prop? This chapter answers the first part of that question and introduces the hidden link that the rest of the tutorial builds on.2 min read[[Prototype]] link.2 min read[[Prototype]] link that property lookup follows. An object literal always links to Object.prototype. Object.create lets you pick the prototype yourself.1 min readObject.create sets a prototype when an object is created. Here you will learn how to read an existing object's [[Prototype]] and how to change it, along with the older __proto__ syntax you will still see i2 min readthis is bound in an ordinary method call (obj.method()), and that you have read the earlier chapters on the prototype chain and Object.create.2 min readObject.create. Reading a property searches up the chain. Writing a property usually does not.1 min readObject.create sets an object's prototype. Here you will learn to tell whether a property lives on the object itself or comes from further up the chain.2 min read[[Prototype]] link and the prototype chain work, and that you can inspect a prototype with Object.getPrototypeOf. So far you have set prototypes by hand with Object.create. Constructor functions do the same thing for you each time you build a new object.2 min readprototype property from the previous chapter, and that you can call a function with a chosen this using call or apply.2 min readprototype property work, what new does, and how property lookup walks the prototype chain.2 min readnew links each instance to the constructor's prototype object. The trap described here comes from those two rules working together.2 min readnew work, what Object.create does, and how call sets this. Before ES2015 added class, developers built inheritance by hand from those pieces. You will still see this pattern in older libraries, and it shows what extends does for1 min readprototype property, and the new operator work, as covered in earlier chapters. ES2015 class syntax adds no new inheritance model. It gives you a cleaner way to write the same constructor-and-prototype pattern, plus a few stricter rul2 min readthis is bound when a method is called.2 min readextends, and super for instance methods, and how property lookup walks the prototype chain.2 min readnew links an instance to Constructor.prototype, and how class and extends set up prototypes. Both operators covered here are questions about the prototype chain. Neither one checks how an object was actually built.1 min readObject.create sets a prototype, and how Object.hasOwn differs from the in operator and for...in.2 min readObject.assign copies properties, how class methods end up on prototype, and how the prototype chain resolves lookups. It covers two topics. The first is sharing behavior without building deep class hierarchies. The second is why you should set an object's protot2 min read