Re: spltting an array (not a string)
You can do it in a single command.
If a is your array, then
var b = a.splice((a.length+1)/2);
cuts the second half of the array out of array a and puts it into array
b.
Without the "+1", the second half would get the extra element if there's
an odd number.
--
The Blackpool Community Church Javascript Team
http://www.econym.demon.co.uk/googlemaps/
0 Comments:
Yorum Gönder
<< Home