From 563ca0a35e98678e2b7d5f154f31f496851e8d60 Mon Sep 17 00:00:00 2001 From: t7yang Date: Mon, 10 Jan 2022 08:38:07 +0800 Subject: remove code tag inside pre tag for zh-CN --- .../global_objects/object/getownpropertydescriptors/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptors') diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptors/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptors/index.html index cc321fa788..22df48a042 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptors/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptors/index.html @@ -41,14 +41,14 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDes

创建子类的典型方法是定义子类,将其原型设置为超类的实例,然后在该实例上定义属性。这么写很不优雅,特别是对于 getters 和 setter 而言。 相反,您可以使用此代码设置原型:

-
function superclass() {}
+
function superclass() {}
 superclass.prototype = {
   // 在这里定义方法和属性
 };
 function subclass() {}
 subclass.prototype = Object.create(superclass.prototype, Object.getOwnPropertyDescriptors({
   // 在这里定义方法和属性
-}));
+}));

规范

-- cgit v1.2.3-54-g00ecf