@extra-array/set.min

Sets value at index. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraArraySetMin from 'https://cdn.skypack.dev/@extra-array/set.min';
</script>

README

Sets value at index. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: set, set$, setPath$.
Similar: get, set, remove.

This is part of package extra-array.

This is browserified, minified version of @extra-array/set.
It is exported as global variable array_set.
CDN: unpkg, jsDelivr.


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

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

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


References