原型链指南

Prototype Chain

Object.getPrototypeOf(obj)Get prototype
obj.__proto__Prototype (legacy, avoid)
obj instanceof ConstructorPrototype chain check
Object.create(proto)Create with specific prototype

Constructor Functions

function Animal(name) { this.name = name; }Constructor function
Animal.prototype.speak = function() {}Add to prototype
new Animal('dog')Create instance

Class Syntax (ES6)

class Animal { constructor(name) { this.name = name; } speak() {} }Class declaration
class Dog extends Animal { speak() { super.speak(); } }Inheritance with super