79107669

Date: 2024-10-20 17:43:26
Score: 0.5
Natty:
Report link

You cannot have the same two keys in map. Once you have tried to write a value with the same key, it will override previous value. What I mean: enter image description here

If you want to check if a Map contains some key before writing it to it, you can just use Map.has method:

if (map.has(key)) throw new Error(`Map is already contains key: "${key}"`)
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: egorgrushin