I'm looking for something similar to this:
const object1 = {
a: 1,
b: 2,
c: 3
};
console.log(Object.getOwnPropertyNames(object1));
// expected output: Array ["a", "b", "c"]
However in my example I have:
const objectArray1 = [
{ a: 112, b: 322, c: 233 },
{ a: 611, b: 232, c: 331 },
{ a: 132, b: 232, c: 342 }
];
What's the most efficient way of getting the ["a", "b", "c"] from this?
Also, that'll probably never happen but if one of objectArray1 objects has d: 345 in it or a missing key/value pair, that needs to be handled.
Any ideas?