每个 JavaScript 对象都有一条隐藏的链接指向另一个对象,称为其 prototype。当你访问一个属性时,JS 在对象自身上查找,然后沿着这个 prototype chain 向上走,直到找到属性或到达 null。这是 委托,而不是复制。
js
animal = {
() { ; },
};
dog = .(animal);
dog. = ;
dog.();
.(dog) === animal;
dog.();
dog.();
