Last active
May 29, 2018 02:48
-
-
Save khaosdoctor/6e453a12d04e36f5c6e03654c6b306ac to your computer and use it in GitHub Desktop.
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
let foo = { | |
[Symbol()]: 'foo', | |
[Symbol('foo')]: 'bar', | |
[Symbol.for('bar')]: 'baz', | |
propriedade: 'legal' | |
} | |
console.log(Object.getOwnPropertySymbols(foo)) // [ Symbol(), Symbol(foo), Symbol(bar) ] | |
for (let symbol of Object.getOwnPropertySymbols(foo)) { | |
console.log(foo[symbol]) | |
// 'foo' | |
// 'bar' | |
// 'baz' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment