Skip to content
Advertisement

How to increase all values of a map in javascript

I have this map:

JavaScript

And I want to add this new key/value:

JavaScript

How can I increase the values of all the old map elements in 1? So I get the following map:

JavaScript

Advertisement

Answer

You can use something like this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement