how to convert array in object in javascript code example
Example 1: convert object to array javascript
var object = {'Apple':1,'Banana':8,'Pineapple':null};
//convert object keys to array
var k = Object.keys(object);
//convert object values to array
var v = Object.values(object);
Example 2: js convert obj to array
const array = [
['key', 1],
['two', 2],
];
Object.fromEntries(array);
// { one: 1, two: 2 }