Object.getOwnPropertySymbols

Returns an array of all own symbol properties in the object.

Syntax

getOwnPropertySymbols(object)

Parameters

Return value

An array of all own symbol properties in the object.

If the object has no own symbol properties, an empty array is returned.

Examples

let vehicle = {
  speed: 10,
  unit: "km/h",
  [Symbol.toStringTag]: "Vehicle"
}
Object.getOwnPropertySymbols(vehicle)
[Symbol.toStringTag]