Skip to content
Subhajit Sahu edited this page Feb 3, 2021 · 13 revisions

Adds value to set. 🏃 📼 📦 🌔 📒

Alternatives: add, add$.
Similar: add, remove.

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

var x = new Set([2, 4, 6, 8]);
set.add$(x, 40);
// Set(5) { 2, 4, 6, 8, 40 }

x;
// Set(5) { 2, 4, 6, 8, 40 }

var x = new Set([2, 4, 6, 8]);
set.add$(x, 80);
// Set(5) { 2, 4, 6, 8, 80 }

references

Clone this wiki locally