From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- .../reference/global_objects/reflect/index.html | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 files/zh-tw/web/javascript/reference/global_objects/reflect/index.html (limited to 'files/zh-tw/web/javascript/reference/global_objects/reflect') diff --git a/files/zh-tw/web/javascript/reference/global_objects/reflect/index.html b/files/zh-tw/web/javascript/reference/global_objects/reflect/index.html new file mode 100644 index 0000000000..4f1d980a0d --- /dev/null +++ b/files/zh-tw/web/javascript/reference/global_objects/reflect/index.html @@ -0,0 +1,130 @@ +--- +title: Reflect +slug: Web/JavaScript/Reference/Global_Objects/Reflect +translation_of: Web/JavaScript/Reference/Global_Objects/Reflect +--- +
{{JSRef}}
+ +

Reflect 是一個內建物件,提供了用於獲取可截取之 JavaScript 操作的方法。這些方法與 proxy handlers 的方法相同。Reflect 不是一個函式物件,因此它是不可建構的。

+ +

描述

+ +

Unlike most global objects, Reflect is not a constructor. You can not use it with a new operator or invoke the Reflect object as a function. All properties and methods of Reflect are static (just like the {{jsxref("Math")}} object).

+ +

方法

+ +

The Reflect object provides the following static functions which have the same names as the proxy handler methods. Some of these methods are the same as corresponding methods on {{jsxref("Object")}}.

+ +
+
{{jsxref("Reflect.apply()")}}
+
Calls a target function with arguments as specified by the args parameter. See also {{jsxref("Function.prototype.apply()")}}.
+
{{jsxref("Reflect.construct()")}}
+
 The new operator as a function. Equivalent to calling new target(...args).
+
{{jsxref("Reflect.defineProperty()")}}
+
Similar to {{jsxref("Object.defineProperty()")}}. Returns a {{jsxref("Boolean")}}.
+
{{jsxref("Reflect.deleteProperty()")}}
+
The delete operator as a function. Equivalent to calling delete target[name].
+
{{jsxref("Reflect.get()")}}
+
A function that returns the value of properties.
+
{{jsxref("Reflect.getOwnPropertyDescriptor()")}}
+
Similar to {{jsxref("Object.getOwnPropertyDescriptor()")}}. Returns a property descriptor of the given property if it exists on the object,  {{jsxref("undefined")}} otherwise.
+
{{jsxref("Reflect.getPrototypeOf()")}}
+
Same as {{jsxref("Object.getPrototypeOf()")}}.
+
{{jsxref("Reflect.has()")}}
+
The in operator as function. Returns a boolean indicating whether an own or inherited property exists.
+
{{jsxref("Reflect.isExtensible()")}}
+
Same as {{jsxref("Object.isExtensible()")}}.
+
{{jsxref("Reflect.ownKeys()")}}
+
Returns an array of the target object's own (not inherited) property keys.
+
{{jsxref("Reflect.preventExtensions()")}}
+
Similar to {{jsxref("Object.preventExtensions()")}}. Returns a {{jsxref("Boolean")}}.
+
{{jsxref("Reflect.set()")}}
+
A function that assigns values to properties. Returns a {{jsxref("Boolean")}} that is true if the update was successful.
+
{{jsxref("Reflect.setPrototypeOf()")}}
+
A function that sets the prototype of an object.
+
+ +

規範

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-reflect-object', 'Reflect')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-reflect-object', 'Reflect')}}{{Spec2('ESDraft')}}Reflect.enumerate has been removed.
+ +

瀏覽器相容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(49.0)}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("42")}}{{CompatNo}}{{CompatNo}}{{CompatSafari(10)}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatChrome(49.0)}}{{CompatChrome(49.0)}}{{CompatVersionUnknown}}{{CompatGeckoMobile("42")}}{{CompatNo}}{{CompatNo}}{{CompatSafari(10)}}
+
+ +

參見

+ + -- cgit v1.2.3-54-g00ecf