Given an input Object, return the number of key/value pairs stored within that Object javascript code example
Example 1: foreach object javascript
const games = {
"Fifa": "232",
"Minecraft": "476"
"Call of Duty": "182"
};
Object.keys(games).forEach((item, index, array) => {
let msg = `There is a game called ${item} and it has sold ${games[item]} million copies.`;
console.log(msg);
});
Example 2: for key value in object javascript
for (const [key, value] of Object.entries(object1)) {
console.log(`${key}: ${value}`);
}