I am trying to extract the names of all keys from an array of objects keeping time complexity as n(One loop only). The array is as below:
var addressArray = [{"city":"New York"},{"country":"USA"},{"zip": 45677}];
I want to extract the below:
var addressKeys = ["city", "country", "zip"].
I am able to do the same by first looping through the array and then using a key in obj loop but that doesn't loo good. Alternatives are most welcome.
addressArrayis not an array, it is an object