-
Notifications
You must be signed in to change notification settings - Fork 5
interleave
Subhajit Sahu edited this page May 19, 2020
·
17 revisions
Places values of an array between another. 🏃 📼 📦 🌔
array.interleave(x, y, [m], [n]);
// x: an array
// y: another array
// m: number of values from x (1)
// n: number of values from y (1)
const array = require('extra-array');
var x = [1, 2, 3, 4];
var y = [10, 20, 30, 40];
array.interleave([x, y]);
// [ 1, 10, 2, 20, 3, 30, 4, 40 ]
var y = [10, 20];
array.interleave([x, y]);
// [ 1, 10, 2, 20, 3, 4 ]