forEach for objects

This commit is contained in:
2023-01-09 01:41:52 +03:00
parent 00e0f5b1a1
commit 6ba3106240
2 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,8 @@
const object1 = {
a: 'somestring',
b: 42
};
for (const [key, value] of Object.entries(object1)) {
console.log(`${key}: ${value}`);
}