The Object keys() static method returns the object's own enumerable property names ("keys") as an array.
const flight = {
start: "Detroit",
end: "Miami",
airline: "Delta",
jet: 767
};
const flightObjKeys = Object.keys(flight);
console.log(flightObjKeys);
// ["start", "end", "airline", "jet"]
// related example
// given object value, get key
function getKeyByValue(object, value) {
return Object.keys(object).find(key => object[key] === value);
}
console.log(getKeyByValue(flight,"Delta"));
// airline