Convert an object to an array in javascript

Convert an Object khổng lồ an Array of Objects #

Use the Object.values() method to convert an object khổng lồ an array of objects,e.g. Const arr = Object.values(obj). The Object.values method takes anobject as a parameter and returns an array containing the object's propertyvalues.

const obj = emp1: id: 1, name: 'Alice', , emp2: id: 2, name: 'Bob', ,;// ✅ Using Object.values()const arrOfObj1 = Object.values(obj);console.log(arrOfObj1); //