最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Does map.set() overwrite the value if the key already exists? - Stack Overflow

programmeradmin4浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 6

According 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.

发布评论

评论列表(0)

  1. 暂无评论