JavaScript Object getOwnPropertyNames() method
returns an array of all properties found directly in a given object

Object.getOwnPropertyNames() method returns an array of all properties (including non-enumerable properties except for those which use Symbol) found directly in a given object.

syntax

Object.getOwnPropertyNames(obj)

obj The object whose enumerable and non-enumerable properties are to be returned.

Object.getOwnPropertyNames() method returns an array of strings that corresponds to the properties found directly in the given object.

Object.getOwnPropertyNames() method does not change the original object.

syntax description
return an array of all properties found directly in myObject
Object.getOwnPropertyNames(myObject)