-
Notifications
You must be signed in to change notification settings - Fork 5
slice$
Subhajit Sahu edited this page May 3, 2023
·
24 revisions
Get part of an array!
function slice$(x, i, I)
// x: an array (updated!)
// i: begin index [0]
// I: end index [|x|]
const xarray = require('extra-array');
var x = [1, 2, 3, 4, 5];
xarray.slice$(x, 2);
// → [ 3, 4, 5 ]
x;
// → [ 3, 4, 5 ]
var x = [1, 2, 3, 4, 5];
xarray.slice$(x, 2, 4);
// → [ 3, 4 ]
var x = [1, 2, 3, 4, 5];
xarray.slice$(x, -3, -1);
// → [ 3, 4 ]