JavaScript Object.getOwnPropertySymbols() Method

The Object.getOwnPropertySymbols() method returns an array of all symbol properties found directly upon a given object. This method returns an empty array unless you have set symbol properties on your object.

Syntax:

Parameter

obj: It is an object whose symbol properties are to be returned.

Return value:

This method returns an array of all symbol properties found directly upon the given object.

Browser Support:

Chrome38
EdgeYes
Firefox36
Opera35

Example 1

Output:

0

Example 2

Output:

2

Example 3

Output:

2





Latest Courses