I have a map of an events of a football game, who looks like this:
const gameEvents = new Map([
[17, '⚽ GOAL'],
[36, ' Substitution'],
[47, '⚽ GOAL'],
[61, ' Substitution'],
[64, ' Yellow card'],
[69, ' Red card'],
[70, ' Substitution'],
[72, ' Substitution'],
[76, '⚽ GOAL'],
[80, '⚽ GOAL'],
[92, ' Yellow card'],
]);
And i need to take every key (that is the minute in the game when an event happened) and calculate the average of minutes when an event happens and log to the console a string like this: 'an event happened on average every 9 minutes'
I don't have a clear idea of what to do to solve the problem