Array.prototype.insert >= 0.1.2

Purpose

Insert item at the given index

Syntax

Array#insert ( Numberindex value );

Parameters

index
Where to insert the values
value

Return values

Array

Examples

Insert a single value at the given index

var arr = [0,1,2,3];

arr.insert(2, 'inserted');>>> [0, 1, 'inserted', 2, 3]

Insert multiple values

var arr = [0,1,2,3];

arr.insert(2, 'i1', 'i2');>>> [0, 1, 'i1', 'i2', 2, 3]