Map.prototype.set()
The set()
method adds or updates an entry in a Map
object with a specified key and a value.
Syntax
set(key, value)
Parameters
key
- : The key of the element to add to the
Map
object. The key may be any JavaScript type (any primitive value or any type of JavaScript object).
- : The key of the element to add to the
value
- : The value of the element to add to the
Map
object. The value may be any JavaScript type (any primitive value or any type of JavaScript object).
- : The value of the element to add to the
Return value
The Map
object.