Skip to content
Subhajit Sahu edited this page May 19, 2020 · 24 revisions

Sets value at index. 🏃 📼 📦 🌔 📒

Similar: [get], [set].

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

var x = [2, 4, 6, 8];
[...iterable.set(x, 1, 40)];
// [ 2, 40, 6, 8 ]

[...iterable.set(x, 3, 80)];
// [ 2, 4, 6, 80 ]

references

Clone this wiki locally