Array.prototype.include >= 0.1.4

Purpose

Include an array (or multiple arrays) at the given index

Syntax

Array#include ( Numberindex Arrayvalues );

Parameters

index
Where to insert the contents of the array
values
The array of values

Return values

Array

Examples

Include an array at the given index

var original = [0, 1, 2, 3, 4, 5],
    second = [99, 98, 97, 96];

original.include(2, second);>>> [0, 1, 99, 98, 97, 96, 2, 3, 4, 5]

Include a single value

var original = [0,1,2];

original.include(1, 'a');>>> [0, 'a', 1, 2]

Include multiple arrays

var original = [0,1,2];

original.include(3, [3,4], [5,6]);>>> [0, 1, 2, 3, 4, 5, 6]