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