Siebel eScript Language Reference > Siebel eScript Commands > Array Objects >

Array splice() Method

This method removes a specified number of elements from the array, starting at a given index, and returns an array of those removed elements. The method then rearranges the remaining elements as necessary to insert a specified number of new elements at the start index of the removed elements. The entire process effectively splices new elements into the array.


arrayName.splice(start, deleteCount[, element1, element2, . . . elementn])



The index at which to splice in the new elements.

  • If start is negative, then (length+start) is used instead; that is, start indicates to splice at an index counting back from the end of the array. For example, start = -1 indicates to splice from the last element in the array.
  • If start is larger than the index of the last element, then the length of the array is used, effectively appending to the end of the array.


The number of elements to remove from the array. All of the available elements to remove are removed if deleteCount is larger than the number of elements available to remove.

element1, element2, . . . elementn

A list of elements to insert into the array in place of the ones that were removed.


An array consisting of the elements that are removed from the original array


This method splices in any supplied elements in place of any elements deleted. Beginning at index start, deleteCount elements are first deleted from the array and inserted into the newly created return array in the same order. The elements of the current array object are then adjusted to make room for the all of the elements passed to this method. The remaining arguments are then inserted sequentially in the space created in the current array object.


var a = new Array( 1, 2, 3, 4, 5 );
TheApplication().RaiseErrorText(a.splice(1,3,6,7) + " " + a);
// Displays 2,3,4   1,6,7,5
// Beginning at element in position 1, three elements (a[1], a[2], a[3] = 2,3,4)
// are replaced with 6,7.

Siebel eScript Language Reference