Reflect.ownKeys()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.
The Reflect.ownKeys()
static method returns an array of the target
object's own property keys.
Try it
const object1 = {
property1: 42,
property2: 13,
};
const array1 = [];
console.log(Reflect.ownKeys(object1));
// Expected output: Array ["property1", "property2"]
console.log(Reflect.ownKeys(array1));
// Expected output: Array ["length"]
Syntax
js
Reflect.ownKeys(target)
Parameters
target
-
The target object from which to get the own keys.
Return value
An