Skip to content
wolfram77 edited this page Mar 27, 2020 · 24 revisions

Sets value at index (+ve, -ve).

Alternatives: default, update.

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

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

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

references

Clone this wiki locally