Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 307
Jan Avatar asked Sep 06 '25 15:09

Jan


1 Answers

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.

like image 83
k0pernikus Avatar answered Sep 08 '25 18:09

k0pernikus