is for loop is use for object in javascript code example
Example 1: javascript loop through object
Object.entries(obj).forEach(
([key, value]) => console.log(key, value)
);
Example 2: for in object javascript
var obj = { foo: 'bar', baz: 42 };
Object.keys(obj).forEach((key) => {
const el = obj[key];
console.log(
{
key: key,
value: el
}
);
});