[Javascript] How do I build a simple array
Lee Underwood
leeu at cfl.rr.com
Thu Sep 7 10:05:08 CDT 2006
You can do that using the shift() method. Think of it as taking the
first element and "shifting" it to the left, out of the array. You
can do it using the following format.
var chevCar = new Array("Nova","Impala","Corvette");
alert("The original lineup is " + chevCar);
chevCar.shift();
alert("The new lineup is " + chevCar);
The first part of the script works just like the previous above.
However, after displaying all of the elements, it removes the first
one and displays an alert window with the remaining two elements.
(See: http://www.webreference.com/programming/javascript/diaries/13/4.html)
Lee Underwood
Jupitermedia Corporation
Managing Editor
WebDeveloper.com | ScriptSearch | JavaScript Source | TheCounter | TheGuestbook
Associate Editor
WebReference.com
On 9/7/2006 10:48 AM, Terry Riegel wrote:
........................................................
>Hello All,
>
>How do I remove the first item from an array?
>
>Terry
........................................................
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060907/3a6dd9ba/attachment.htm>
More information about the Javascript
mailing list