Object getOwnPropertySymbols() method

Find all information about the JavaScript getOwnPropertySymbols() method of the Object object

Get the array of symbols defined on the object.

symbolIt is a feature of ES2015, and this method is also introduced in ES2015.

example:

const dog = {}
const r = Symbol('Roger')
const s = Symbol('Syd')
dog[r] = {
  name: 'Roger',
  age: 6
}
dog[s] = {
  name: 'Syd',
  age: 5
}

Object.getOwnPropertySymbols(dog) //[ Symbol(Roger), Symbol(Syd) ]

Download mine for freeJavaScript beginner's manual


More js tutorials: