JavaScript Object keys() method returns an array of a given object’s own enumerable property names. The ordering of the properties is the same as that given by the object manually in a loop applied to the properties.
Object.keys(obj)
JavaScript object keys
A simple example code gets all keys of a given object.
<!DOCTYPE html>
<html>
<body>
<script>
var obj = {name: "Martin", age: 30, city: "United States"};
let res = Object.keys(obj);
console.log(res);
</script>
</body>
</html>
Output:

Do comment if you have any doubts or suggestions on this Js Object key topic.
Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version

Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.