Array Power, Part III - DHTML Lab | 3
Array Power, Part III
splice() demo
In the following example, we start with our usual array: [0,"cat",true]
Enter a first argument for splice() in the Index field.
Enter a second argument for splice() in the Count field.
The SELECT menu has several values which you can add as elements to the array. They are a mix of string, Boolean, number and array values. Select one or more values to add to the array.
Click the splice( ) button to execute the splice() method.
The JavaScript statement generated is displayed in the Statement field.
The contents of the array before the statement is executed are displayed in the Old myArray field.
The contents of the array after the statement is executed are displayed in the New myArray field.
The splice() method's return value appears in the removedElements field.
Now on to a simple real world use for splice().
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.Created: May 16, 2000
Revised: May 16, 2000
URL: https://www.webreference.com/dhtml/column33/11.html