Skip to content

Instantly share code, notes, and snippets.

@matthieuprat
Last active March 9, 2017 11:13
Show Gist options
  • Save matthieuprat/edfb5ad8b86bfc4e726eed3d420ccc41 to your computer and use it in GitHub Desktop.
Save matthieuprat/edfb5ad8b86bfc4e726eed3d420ccc41 to your computer and use it in GitHub Desktop.
Enumerability and ownership of Symbol properties
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