Skip to content

Commit 58314b4

Browse files
committed
Exmple for getOwnKeys
1 parent f71b970 commit 58314b4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

JavaScript/6-keys.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
const data = { name: 'Marcus Aurelius', city: 'Rome', _born: 121 };
4+
5+
const person = new Proxy(data, {
6+
ownKeys(obj) {
7+
return Object.keys(obj).filter(name => !name.startsWith('_'));
8+
}
9+
});
10+
11+
console.dir(Object.keys(person));

0 commit comments

Comments
 (0)