JavaScript Arrays Object keys and values to array

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

var object = {
    key1: 10,
    key2: 3,
    key3: 40,
    key4: 20
};
 
var array = [];
for(var people in object) {
  array.push([people, object[people]]);
}

Now array is

[
  ["key1", 10],
  ["key2", 3],
  ["key3", 40],
  ["key4", 20]
]


Got any JavaScript Question?