Home » JavaScript Reflect ownKeys() Method

JavaScript Reflect ownKeys() Method

by Online Tutorials Library

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:

Chrome 49
Edge 12
Firefox 42
Opera 36

Example 1

Output:

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

Example 2

Output:

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

Example 3

Output:

  []   ["hoo"]  
Next TopicJavaScript Reflect

You may also like