Since the introduction of ES6 we can quickly loop over every key/value pair inside a JavaScript object.

Lets say we have a object, and we want to loop over its properties

const crunchySnacks = {
    'chocolate': '🍫',
    'cookie': '🍪',
    'popcorn': '🍿'
}

This is how we loop over object keys

Object.keys(crunchySnacks).forEach((key, index) => {
    console.log(`Object index ${index} has key ${key}`)
})

Outputs:
Object index 0 has key chocolate
Object index 1 has key cookie
Object index 2 has key popcorn

And how to loop over object key value pairs

Object.entries(crunchySnacks).forEach((keyValuePair, index) => {
    console.log(keyValuePair)
})

Outputs:
[ 'chocolate', '🍫' ]
[ 'cookie', '🍪' ]
[ 'popcorn', '🍿' ]