interleaveArray()function

interleaveArray(items: PossibleArray<T>, separator: T): ImmutableArray<T>
interleaveArray(items: PossibleArray<A>, separator: B): ImmutableArray<A | B>
ParamType
itemsPossibleArray<T>
The array or iterable to interleave. required
separatorT
The value to insert between each pair of items. required
itemsPossibleArray<A>
Things that can be converted to arrays. required
separatorB
required
Return
ImmutableArray<T>
A new array with separator inserted between items, or the same array if it had fewer than two items.
ImmutableArray<A | B>
Immutable array: an array that cannot be changed.

Interleave array items with a separator.

Examples

interleaveArray([1, 2, 3], 0) // [1, 0, 2, 0, 3]