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

Sets value at key. 🏃 📼 📦 🌔 📒

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

array.set(x, i, v);
// x: an array
// i: index
// v: value
const object = require('extra-object');

var x = {a: 2, b: 4, c: 6, d: 8};
object.set$(x, 'b', 40);
// { a: 2, b: 40, c: 6, d: 8 }

x;
// { a: 2, b: 40, c: 6, d: 8 }

var x = {a: 2, b: 4, c: 6, d: 8};
object.set$(x, 'd', 80);
// { a: 2, b: 4, c: 6, d: 80 }

references

Clone this wiki locally