Baseline Widely available
Reflect.get()
ì ì ë©ìëë ê°ì²´ì ìì±ì ê°ì ¸ì¤ë í¨ìì
ëë¤. target[propertyKey]
ì ë¹ì·í©ëë¤.
const object1 = {
x: 1,
y: 2,
};
console.log(Reflect.get(object1, "x"));
// Expected output: 1
const array1 = ["zero", "one"];
console.log(Reflect.get(array1, 1));
// Expected output: "one"
구문
Reflect.get(target, propertyKey[, receiver])
매ê°ë³ì
target
ìì±ì ê°ì ¸ì¬ ëì ê°ì²´.
propertyKey
ê°ì ¸ì¬ ìì±ì ì´ë¦.
receiver
Optional
ëì ìì±ì´ ì ê·¼ìë¼ë©´ this
ì ê°ì¼ë¡ ì¬ì©í ê°. Proxy
ì í¨ê» ì¬ì©íë©´, ëìì ììíë ê°ì²´ë¥¼ ì¬ì©í ì ììµëë¤.
ìì±ì ê°.
ìì¸target
ì´ Object
ê° ìëë©´ TypeError
.
Reflect.get
ë©ìëë ê°ì²´ ìì±ì ê°ì ê°ì ¸ì¬ ì ììµëë¤. ìì± ì ê·¼ìì í¨ìíì´ë¼ê³ í ì ììµëë¤.
Reflect.get()
ì¬ì©í기
// Object
var obj = { x: 1, y: 2 };
Reflect.get(obj, "x"); // 1
// Array
Reflect.get(["zero", "one"], 1); // "one"
// handler 매ê°ë³ìì Proxy
var x = { p: 1 };
var obj = new Proxy(x, {
get(t, k, r) {
return k + "bar";
},
});
Reflect.get(obj, "foo"); // "foobar"
ëª
ì¸ ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4