for (variable in object) {
    // code to execute
}
const person = {
    name: "John",
    age: 30,
    occupation: "Developer"
} // Object defined using an object literal

for (let key in person) {
    console.log(key); // Logs the property name
}
The console output will be:
const person = {
    name: "John",
    age: 30,
    occupation: "Developer"
} // Object defined using an object literal

for (let key in person) {
    console.log(key + ": " + person[key]); // Logs the property name and value
}
The console output will be:
const parent = {
    parentProp: "I am from parent"
} // Object defined using an object literal

const child = Object.create(parent);
child.childProp = "I am from child";

for (let key in child) {
    console.log(key); // Logs: parentProp, childProp
}

for (let key in child) {
    if (child.hasOwnProperty(key)) {
        console.log(key); // Logs: childProp only
    }
}
const obj = {
    enumerableProp: "I will be enumerated",
} // Object defined using an object literal

Object.defineProperty(obj, "nonEnumerableProp", {
    value: "I will not be enumerated",
    enumerable: false
});

for (let key in obj) {
    console.log(key); // Logs: enumerableProp only
}
for (let key in object) {
    if (object.hasOwnProperty(key)) {
        // Perform operations on the object's own properties
    }
}
Object.defineProperty(object, "nonEnumerableProperty", {
    value: "This property is not enumerable",
    enumerable: false
});
const obj = null;

for (let key in obj) {
    // This block will not execute
}
const person = {
    name: "John",
    age: 30,
    occupation: "Developer"
}

const keys = Object.keys(person);
const values = Object.values(person);
const entries = Object.entries(person);

console.log(keys);    // ['name', 'age', 'occupation']
console.log(values);  // ['John', 30, 'Developer']
console.log(entries); // [['name', 'John'], ['age', 30], ['occupation', 'Developer']]
const values = Object.values(person);

for (const value of values) {
    console.log(value);
}
const person = {
    name: "John",
    age: 30,
    occupation: "Developer"
};

const entries = Object.entries(person);

entries.forEach(([key, value]) => {
    console.log(key + ": " + value);
});