Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

Array.insert Function

Inserts a single item into a specified index of an Array object. This function is static and can be invoked without creating an instance of the object.

Syntax

Array.insert(array, index, item);

Arguments

Term

Definition

array

The array to insert the item into.

index

The index location where item should be inserted.

item

The object to add to the array.

Remarks

Use the insert function to insert an item into a specified index of an Array object. The index value of items that are greater than index is increased by one.

Calling the insert function and passing a negative value for index counts backward from the end of the array. Floating point values are rounded down to a whole number value.

Example

The following example shows how to use the insert function to insert an item into an array.

JavaScript

var a = ['a', 'b', 'd', 'e'];
Array.insert(a, 2, 'c');
// View the results: "a,b,c,d,e"
alert(a);