From d9e9adb5f80a819fe46349bcf6d1faec734b09cd Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:07:31 +0800 Subject: remove span tag in zh-CN --- .../reference/global_objects/reflect/construct/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/reflect/construct/index.html') diff --git a/files/zh-cn/web/javascript/reference/global_objects/reflect/construct/index.html b/files/zh-cn/web/javascript/reference/global_objects/reflect/construct/index.html index 8c6c4e2126..174cab0ccb 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/reflect/construct/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/reflect/construct/index.html @@ -40,7 +40,7 @@ var obj = Reflect.construct(Foo, args);

Reflect.construct() vs Object.create()

-

在新语法Reflect出现之前,是通过明确指定构造函数和原型对象( 使用{{jsxref("Object.create()")}})来创建一个对象的。

+

在新语法Reflect出现之前,是通过明确指定构造函数和原型对象( 使用{{jsxref("Object.create()")}})来创建一个对象的。

function OneClass() {
     this.name = 'one';
@@ -68,7 +68,7 @@ console.log(obj2 instanceof OtherClass); // true

虽然两种方式结果相同,但在创建对象过程中仍一点不同。 

-

当使用Object.create()和{{jsxref("Function.prototype.apply()")}}时,如果不使用new操作符调用构造函数,构造函数内部的new.target值会指向undefined

+

当使用Object.create()和{{jsxref("Function.prototype.apply()")}}时,如果不使用new操作符调用构造函数,构造函数内部的new.target值会指向undefined

当调用Reflect.construct()来创建对象,new.target值会自动指定到target(或者newTarget,前提是newTarget指定了)。

@@ -97,7 +97,7 @@ OneClass.apply(obj3, args); // OneClass // undefined -

举例

+

举例

使用 Reflect.construct()

-- cgit v1.2.3-54-g00ecf