@extra-array/slice-update

Gets a part of array. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraArraySliceUpdate from 'https://cdn.skypack.dev/@extra-array/slice-update';
</script>

README

Gets a part of array. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: slice, slice$.

This is part of package extra-array.


array.slice$(x, [i], [I]);
// x: an array (updated)
// i: start index (0)
// I: end index (X)
// → x
const array = require("extra-array");

var x = [1, 2, 3, 4, 5];
array.slice$(x, 2);
// [ 3, 4, 5 ]

x;
// [ 3, 4, 5 ]

var x = [1, 2, 3, 4, 5];
array.slice$(x, 2, 4);
// [ 3, 4 ]

var x = [1, 2, 3, 4, 5];
array.slice$(x, -3, -1);
// [ 3, 4 ]


References