JavaScript Object.getOwnPropertySymbols() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Object

Definition

Object.getOwnPropertySymbols(obj) returns an array of all own Symbol property keys on obj. String keys are ignored.

Symbols are unique keys that stay off the usual Object.keys() and for...in lists. Use this method when you need to find or copy those hidden keys.

Syntax

Call Object.getOwnPropertySymbols() like this. Start with this line.

JavaScript
Object.getOwnPropertySymbols(obj)
CallWhat it does
Object.getOwnPropertySymbols(obj)Returns an array of every own Symbol key on obj.

Built into JavaScript. Call on Object — no import required.

Library declarations
JavaScript
Object.getOwnPropertySymbols(obj)
JavaScript
getOwnPropertySymbols(o: object): symbol[];

Parameters

ParameterDescription
objRequired. The object to inspect. Primitives are boxed first.

Return Value

Return ValueDescription
symbol[]An array of own Symbol keys. Empty if the object has no symbol properties.

JavaScript Examples

Example 1 — Basic Use

Attach a Symbol key and list it with getOwnPropertySymbols.

JavaScript
var id = Symbol("id");
var user = { name: "Ada" };
user[id] = 101;

console.log(Object.keys(user));
console.log(Object.getOwnPropertySymbols(user));
console.log(user[Object.getOwnPropertySymbols(user)[0]]);
Try It Yourself

How It Works

  1. Create a Symbol Symbol("id") makes a unique key. The description "id" is only a label.
  2. Store a value Assign with bracket notation: user[id] = 101.
  3. List symbol keys Object.keys shows only name. getOwnPropertySymbols returns the Symbol.

Example 2 — Several Symbols

An object can hold more than one Symbol key.

JavaScript
var type = Symbol("type");
var meta = Symbol("meta");
var item = {};
item[type] = "book";
item[meta] = { pages: 200 };
item.title = "JS Tips";

var syms = Object.getOwnPropertySymbols(item);
console.log(syms.length);
console.log(item[syms[0]]);
console.log(item[syms[1]].pages);
Try It Yourself

How It Works

  1. Two unique keys Each Symbol() call creates a different key, even with similar labels.
  2. String key stays separate title is a normal string property and is not returned here.
  3. Read by symbol Use the symbols from the array to read the stored values again.

Example 3 — No Symbols

Objects without Symbol keys return an empty array.

JavaScript
var plain = { a: 1, b: 2 };

console.log(Object.getOwnPropertySymbols(plain));
console.log(Object.getOwnPropertyNames(plain));
Try It Yourself

How It Works

  1. Only string keys plain has a and b, both strings.
  2. Empty symbol list getOwnPropertySymbols returns [] when there are no Symbol keys.
  3. Names still work getOwnPropertyNames lists the string keys as usual.

Browser & Runtime Support

Object.getOwnPropertySymbols() arrived with ES6 (ES2015) together with the Symbol type. It is Baseline in modern engines.

✓ Baseline · ES6

Object.getOwnPropertySymbols()

Supported in Chrome 38+, Firefox 36+, Safari 9+, Edge 12+, and Node.js 4+.

98% Modern browser support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Object.getOwnPropertySymbols Excellent

Bottom line: Safe for modern JavaScript. Remember that older ES5-only engines have no Symbol type at all.

Frequently Asked Questions

It returns an array of all own Symbol property keys on an object. String keys are not included.
Symbols were designed as unique keys that do not collide with normal string property names and stay out of casual enumeration.
No. Only Symbols defined directly on the object are returned.
Use Reflect.ownKeys(obj), which returns string names first, then Symbol keys.
Yes, if they are own properties on that object — for example a custom Symbol.iterator you assigned yourself.

Next: getPrototypeOf()

Find the object another object inherits from.

getPrototypeOf() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful