xxxxxxxxxx
const person = {
firstName: 'John',
lastName: 'Doe',
age: 30,
city: 'New Work'
};
const keyToFind = 'age';
if (Object.keys(person).find(e=> e===keyToFind)) {
console.log('Key exists in the object!');
} else {
console.log('Key does not exist.');
}
// Output: "Key exists in the object!"