const obj = { name: 'Daniel', age: 40, occupation: 'Engineer', level: 4 };
console.log(Object.keys(obj));
// Expected output: ["name", "age", "occupation", "level"]
console.log(Object.values(obj));
// Expected output: ["Daniel", 40, "Engineer", 4]
console.log(Object.entries(obj));
// Expected output: [["name", "Daniel"], ["age", 40], ["occupation", "Engineer"], ["level", 4]]
参考
JavaScript - How to Get an Object’s Keys and Values in JavaScript