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?
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?
Share Improve this question edited Mar 15, 2021 at 8:51 Jan asked Jan 4, 2021 at 14:36 JanJan 771 gold badge2 silver badges13 bronze badges 3- 2 Yes – VLAZ Commented Jan 4, 2021 at 14:41
- what should happen instead? – Nina Scholz Commented Jan 4, 2021 at 14:50
- An exception ('key already present') – John Pool Commented Mar 12, 2021 at 13:03
1 Answer
Reset to default 6According to developer.mozilla on Map.set
The set() method adds or updates an element with a specified key and a value to a Map object.
I remend looking up prototype functions on native objects on developer.mozilla at first.