JavaScript Reflect.ownKeys() Method

The static Reflect.ownKeys() method returns an array whose values represents the keys of the properties of a provided object. It ignores the inherited properties.

Syntax:

Parameters:

Obj: It is the target object from which to get the own keys.

Return value:

IT returns an Array of the target object's own property keys.

Exceptions:

A TypeError, if the target is not an Object.

Browser Support:

Chrome49
Edge12
Firefox42
Opera36

Example 1

Output:

 ["a", "b"]
["a", "b"]

Example 2

Output:

 ["a", "b"]
 ["a", "b", "c"]
 ["a", "b", "c"]

Example 3

Output:

  []
 ["hoo"]




Latest Courses