JavaScript Object keys() method
returns an array with the keys of an object

Object.keys() static method returns an array with the keys of an object.

Object.keys() method returns an array of strings representing the given object's own enumerable string-keyed property keys.

This is the same as iterating with a for...in loop, except that a for...in loop enumerates properties in the prototype chain as well.

syntax

Object.keys(obj)

obj An object.

If you need the property values, use Object.values() instead.

If you need both the property keys and values, use Object.entries() instead.

The order of the array returned is the same as that provided by a for...in loop.

const myObject = { 'a': 3, 'b': 6, 'c': 9 };

Object.keys(myObject);

returns ['a', 'b', 'c']

syntax description
return an array with the keys of an object
Object.keys(myObject)