Skip to content
Advertisement

Does map.set() overwrite the value if the key already exists?

I was wondering if map.set() overwrites the value if the key already exists in the map.

How can I test this easily when in a big project? Are there any website you can use for javascript coding?

Advertisement

Answer

According to developer.mozilla.org on Map.set

The set() method adds or updates an element with a specified key and a value to a Map object.

I recommend looking up prototype functions on native objects on developer.mozilla.org at first.

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