I have an object with the following format
var obj = [{
"a": 1
}, {
"b": 2
}, {
"c": 3
}];
Would want to fetch only keys out of each object inside this array of objects into a new array
Something like this:
["a","b","c"]
Have tried the following but it is not working :
var obj = [{
"a": 1
}, {
"b": 2
}, {
"c": 3
}];
let result = obj.map (({ val }) => val)
console.log(result);