I was learning about Object.entries
in Javascript and I came across the following code snippet:
const object1 = {
a: 'somestring',
b: 42
};
for (const [key, value] of Object.entries(object1)) {
console.log(`${key}: ${value}`);
}
// expected output:
// "a: somestring"
// "b: 42"
we can see that there is a "of " keyword used in here; can anyone tell me how it works?
for (const [key, value] of Object.entries(object1)) {