@extra-array/intersperse
v2.10.19
Published
Places a separator between every value.
Downloads
80
Readme
Places a separator between every value. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:
Similar: interleave, intermix, interpolate, intersperse.
This is part of package extra-array.
array.intersperse(x, v);
// x: an array
// v: separator
const array = require("extra-array");
var x = [1, 2, 3];
array.intersperse(x, 10);
// [ 1, 10, 2, 10, 3 ]
var x = [1, 2, 3, 4];
array.intersperse(x, 10);
// [ 1, 10, 2, 10, 3, 10, 4 ]