Loading topic
obj.key. This chapter covers what an object is, how property keys work, and the steps JavaScript takes to look up a property. Later chapters extend this lookup to the prototype chain, so the details her4 min readnull. That reference is how inheritance works in JavaScript. Later chapters show how looku3 min readthis is bound in a method call. It builds on the previous chapter: every object has a hidden [[Prototype]] link that points to another object or to null. Here you follow those links one after 3 min read[[Prototype]] link and that property lookup follows that link up the chain. Object literals always link to Object.prototype. To make an object inherit from an object you pick, use Object.create.4 min readthis is bound in method calls, and how to run code in Node.js or a browser console. It also builds on the earlier chapters: every object has a hidden [[Prototype]] link, property lookup walks the chain of those links, and Object.create sets th3 min readthis is bound in an ordinary method call (obj.method()). It also assumes you know how property lookup walks the prototype chain and how Object.create sets a prototype, both covered in earlier chapters. Here we join those ideas: what happens to this when the 4 min readObject.create, and how this refers to the receiver in inherited methods. In the earlier chapters, values only travelled up the chain when you read them. This chapter covers writes, whi4 min readObject.create sets a prototype. Both were covered earlier in the tutorial. You should also be comfortable with object literals and running code in Node.js or a browser console.3 min readObject.create sets an object's [[Prototype]], and how this refers to the receiver when an inherited method is called. Here those ideas are applied to the main way JavaScript created families of similar objects bef4 min readprototype property, which the previous chapter covered. You should also know what Object.create and Object.getPrototypeOf do, and how this is bound when a function is called as a method. Here we open 3 min readprototype property work, what new does, and how to check own properties with Object.hasOwn. Those topics were covered in the previous chapters.4 min readnew does when it links an instance to Constructor.prototype. Here we look at a bug those rules produce when the value on the prototype is an object, such4 min readprototype property work, what new does step by step, and what the constructor property is for. Here those pieces come together. You will build a parent-child relationship between two constructor functions by hand. This i4 min readprototype property, and what new does, all covered in earlier chapters. ES2015 class syntax adds no new inheritance model. A class declaration creates a constructor function and places methods on that function's prototype objec3 min readnew works with constructor functions, the pre-class inheritance pattern built from Object.create and Parent.call(this), and basic class syntax. The extends and super keywords replace that manual wiring. They also add a few rules that4 min readextends links Child.prototype to Parent.prototype, how super calls parent methods, and how shadowing works when you assign to an inherited property. Here the focus moves from instances to the constructors themselves. When you write `class Dog extends4 min readnew links an instance to Constructor.prototype, and how extends links one class prototype to another. These are covered in earlier chapters. Here you will see how JavaScript's two built-in "is this a kind of that?" checks use3 min readObject.hasOwn and for...in treat inherited properties, and how constructor functions use their prototype property. Everything here applies those ideas to the objects JavaScript gives you for free.4 min readObject.create(proto) sets an object's [[Prototype]], how lookup walks the prototype chain, and how Object.hasOwn differs from the in operator. Here we pass null as the prototype. The result is an object with no chain at all, and that is useful when3 min readclass, extends, and super map onto prototype links, and that you can tell own properties from inherited ones with Object.hasOwn. Every example runs as written in Node.js or a browser console.4 min readObject.create and Object.getPrototypeOf work, and how classes and constructor functions set up prototype links. You don't need any knowledge of engine internals. The chapter explains what engines do with prototy4 min read