Baseline Widely available
Reflect.has()
ì ì ë©ìëë in
ì°ì°ìì í¨ìíì
ëë¤.
const object1 = {
property1: 42,
};
console.log(Reflect.has(object1, "property1"));
// Expected output: true
console.log(Reflect.has(object1, "property2"));
// Expected output: false
console.log(Reflect.has(object1, "toString"));
// Expected output: true
구문
Reflect.has(target, propertyKey);
매ê°ë³ì
target
ìì±ì íìí ê°ì²´.
propertyKey
íìí ìì±ì ì´ë¦.
ê°ì²´ê° ìì±ì ê°ì§ê³ ìëì§ ëíë´ë Boolean
.
target
ì´ Object
ê° ìëë©´ TypeError
.
Reflect.has()
ë©ìëë ê°ì²´ì ìì±ì´ ì¡´ì¬íëì§ íë³í ì ììµëë¤. in
ì°ì°ìì²ë¼ ëìí©ëë¤.
Reflect.has()
ì¬ì©í기
Reflect.has({ x: 0 }, "x"); // true
Reflect.has({ x: 0 }, "y"); // false
// íë¡í íì
ì²´ì¸ì ì¡´ì¬íë ìì±ë true ë°í
Reflect.has({ x: 0 }, "toString");
// .has() ì²ë¦¬ê¸° ë©ìë를 ê°ì§ Proxy
obj = new Proxy(
{},
{
has(t, k) {
return k.startsWith("door");
},
},
);
Reflect.has(obj, "doorbell"); // true
Reflect.has(obj, "dormitory"); // false
ëª
ì¸ ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
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