Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zh-cn: sync the translation of 'inheritance and the prototype chain' #24216

Merged
merged 17 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion files/zh-cn/glossary/class/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ l10n:
## 参见

- [JavaScript 中的类](/zh-CN/docs/Learn/JavaScript/Objects/Classes_in_JavaScript)
- [继承和原型链](/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain)
- [继承与原型链](/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain)
- 维基百科上的[基于类编程](https://zh.wikipedia.org/wiki/基于类编程)
- 维基百科上的[面向对象程序设计](https://zh.wikipedia.org/wiki/面向对象程序设计)
2 changes: 1 addition & 1 deletion files/zh-cn/glossary/inheritance/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ l10n:

## 参见

- [继承和原型链](/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain)
- [继承与原型链](/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain)
2 changes: 1 addition & 1 deletion files/zh-cn/glossary/prototype/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ l10n:

原型是一种在开发生命周期的早期显示应用程序或产品的外观和行为的模型。

参见[继承和原型链](/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain)。
参见[继承与原型链](/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain)。

## 参见

Expand Down
2 changes: 1 addition & 1 deletion files/zh-cn/web/javascript/closures/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -564,4 +564,4 @@ MyObject.prototype.getMessage = function () {
};
```

在前面两个示例中,继承的原型由所有的对象共享,因此方法定义不需要出现在对象创建中。参见[继承和原型链](/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain)了解更多。
在前面两个示例中,继承的原型由所有的对象共享,因此方法定义不需要出现在对象创建中。参见[继承与原型链](/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain)了解更多。
2 changes: 1 addition & 1 deletion files/zh-cn/web/javascript/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ JavaScript 核心语言特性(大部分是纯 [ECMAScript](/zh-CN/docs/Web/Jav

### 高级

- [继承和原型链](/zh-CN/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain)
- [继承与原型链](/zh-CN/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain)
- : 解释被广泛误解与低估的基于原型的继承。
- [内存管理](/zh-CN/docs/Web/JavaScript/Memory_management)
- : JavaScript 的内存生命周期和垃圾回收。
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Object.prototype.propertyIsEnumerable.call(obj, "foo"); // true;预期的结

### null 原型对象

几乎所有的 JavaScript 对象最终都继承自 `Object.prototype`(参见[继承和原型链](/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain))。然而,你可以使用 [`Object.create(null)`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/create) 或定义了 `__proto__: null` 的[对象字面量语法](/zh-CN/docs/Web/JavaScript/Reference/Operators/Object_initializer)(注意:对象字面量中的 `__proto__` 键不同于已弃用的 [`Object.prototype.__proto__`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) 属性)来创建 `null` 原型对象。你还可以通过调用 [`Object.setPrototypeOf(obj, null)`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf) 将现有对象的原型更改为 `null`。
几乎所有的 JavaScript 对象最终都继承自 `Object.prototype`(参见[继承与原型链](/zh-CN/docs/Web/JavaScript/Inheritance_and_the_prototype_chain))。然而,你可以使用 [`Object.create(null)`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/create) 或定义了 `__proto__: null` 的[对象字面量语法](/zh-CN/docs/Web/JavaScript/Reference/Operators/Object_initializer)(注意:对象字面量中的 `__proto__` 键不同于已弃用的 [`Object.prototype.__proto__`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) 属性)来创建 `null` 原型对象。你还可以通过调用 [`Object.setPrototypeOf(obj, null)`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf) 将现有对象的原型更改为 `null`。

```js
const obj = Object.create(null);
Expand Down