Skip to content
Subhajit Sahu edited this page Mar 17, 2020 · 25 revisions

Breaks array considering filter as separator.

array.split(x, fn, [ths]);
// x:   an array
// fn:  filter function (v, i, x)
// ths: this argument
// --> [...pieces]
const array = require('extra-array');

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

array.copyWithin(a, 3, 1);
// [1, 2, 3, 2, 3]

array.copyWithin(a, 3, 1, 2);
// [1, 2, 3, 2, 5]

references

Clone this wiki locally