cara mengonversi objek ke daftar di js

/*
if you want to create an array from all the properties names of an object you use
the Object.keys() method;
if you want to make an array out of the values you use the Object.values() method;
if you want to create an array from both keys and values use the
Object.entries() method;
*/

const client= {
  "name": "John",
  "id": 00019857,
  "itemsPurchased": [
  	"apple",
  	"banana",
  	"kiwi",
  ]
}

Examples:
// with the keys
console.log(Object.keys(client));
// output: ["name", "id", "itemsPurchased"]

// with the values
console.log(Object.values(client));
// output: ["John", 00019857, ["apple", "banana", "kiwi"]]

// with both keys and values
console.log(Object.entries(client));
// output: [("name", "john"), ("id", 00019857), ("itemsPurchased", ["apple", "banana"])]
Cloudy Caribou