Skip to content
Subhajit Sahu edited this page Jun 13, 2020 · 14 revisions

Adds value to set.

Alternatives: [set], [set$].
Similar: [get], [set], [remove].

set.add(x, v);
// x: a set
// v: value
const map = require('extra-map');

var x = new Map([['a', 2], ['b', 4], ['c', 6], ['d', 8]]);
map.set(x, 'b', 40);
// Map(4) { 'a' => 2, 'b' => 40, 'c' => 6, 'd' => 8 }

map.set(x, 'd', 80);
// Map(4) { 'a' => 2, 'b' => 4, 'c' => 6, 'd' => 80 }

references

Clone this wiki locally