Object.getOwnPropertySymbolsbeginner// Get all Symbol-keyed properties
const sym = Symbol('id')
const obj = { [sym]: 1, name: 'Alice' }
Object.getOwnPropertySymbols(obj) // β [Symbol(id)]Use Object.getOwnPropertySymbols() to retrieve all symbol-keyed own properties, which are invisible to Object.keys().
An object can have multiple Symbol-keyed properties. Object.getOwnPropertySymbols returns all of them.
Challenge: Implement countSymbols(obj) that returns the number of Symbol-keyed properties.
const s1 = Symbol('a'); const s2 = Symbol('b')
countSymbols({ [s1]: 1, [s2]: 2 }) // β 2