Skip to content

cutRight

Subhajit Sahu edited this page Mar 17, 2020 · 23 revisions

Breaks array after given indices.

array.cutRight(x, is);
// x:  an array
// is: split indices (sorted)
// --> [...pieces]
const array = require('extra-array');

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

a;
// [3, 4, 5]

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

b;
// [3, 4]

references

Clone this wiki locally