Skip to content

Commit fad699d

Browse files
author
Walle Cyril
authored
Reflect.has
1 parent b57c08c commit fad699d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

js/Object.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,19 @@ Object.entries(anObject).forEach(function ([key, value]) {
5151

5252
});
5353

54+
// iterate over the object and its full prototype chain
55+
let key;
56+
for (key in anObject) {
57+
anObject[key]; // value
58+
}
59+
5460
// has a key
5561
anObject.hasOwnProperty("key");
5662

5763
// has safe, works even when anObject has a key "hasOwnProperty"
58-
// alsow works for Objects without prototype
64+
// also works for Objects without prototype
5965
Object.prototype.hasOwnProperty.call(anObject, "key");
66+
Reflect.has(anObject, "key")
6067

6168
// remove a value
6269
anObject["key"] = undefined;

0 commit comments

Comments
 (0)