JavaScript objects can inherit properties and methods through links to other objects, rather than relying solely on class-based inheritance. A constructor function’s `prototype` supplies the prototype for objects created with `new`; arrow functions cannot be used as constructors. section 1.1 section 9.3.2
Listing 9.5 Creating a new instance with a prototyped method
function Ninja() {} #A
Ninja.prototype.swingSword = () => true; #B
// @ts-expect-error -- Ninja has no construct signature #C
const ninja = new Ninja(); #D
console.assert( #D
ninja.swingSword() === true, #D
"swingSword is inherited from the prototype.", #D
); #D
console.assert( #E
ninja instanceof Ninja, #E
"instanceof confirms that ninja is a Ninja", #E
); #E
A constructor adds `swingSword` to its prototype; the new object inherits the method, and `instanceof` checks its relationship to the constructor. section 9.3.2
Inherited properties act as fallbacks when an object lacks the property itself. Even `{}` has a prototype—`Object.prototype`—while `Object.create(null)` makes an object with no prototype. JavaScript’s `class` syntax uses prototypes under the hood. section 9.3.2 section 1.1



