Here's a comparison between the for...in
loop and Object.keys()
for iterating over object properties in JavaScript:
The for...in
loop iterates over all enumerable property keys of an object, including inherited properties from its prototype chain.
const obj = { a: 1, b: 2, c: 3 };
for (const key in obj) {
console.log(key, obj[key]);