Standard built-ins

Object.getOwnPropertySymbols()

Try the free JavaScript compiler

Returns all own symbol keys, excluding string keys.

Formal Syntax & Structure

javascript syntaxjavascript
Object.getOwnPropertySymbols(obj)

Parameters & Attributes

NameTypeDescription
objObjectTarget object.

Return Value

Array

Own symbol keys.

Working Example

Example Snippetjavascript
const s=Symbol("n");console.log(Object.getOwnPropertySymbols({[s]:2})[0]===s);
JavaScript Reference