Last active
March 9, 2017 11:13
-
-
Save matthieuprat/edfb5ad8b86bfc4e726eed3d420ccc41 to your computer and use it in GitHub Desktop.
Enumerability and ownership of Symbol properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s = Symbol() | |
const o = { [s]: 1 } | |
o.hasOwnProperty(s) | |
//-> true | |
Object.getOwnPropertyNames(o) | |
//-> [] | |
Object.getOwnPropertySymbols(o) | |
//-> [Symbol()] | |
o.propertyIsEnumerable(s) | |
//-> true | |
Object.keys(o) | |
//-> [] | |
Object.entries(o) | |
//-> [] | |
Object.assign({}, o)[s] | |
//-> 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment