View Single Post
Old 08-31-2007, 11:57 AM   #1 (permalink)
markster
Code Monkey
 
markster's Avatar
 
Join Date: Jun 2006
Posts: 65
markster is on a distinguished road
Question Swap elements in array?

Is there any kind of code that will swap the elements that are in the middle of an array, eg:

Code:
var array = new Array("a","b","c","d","e","f","g","h");
swap(array,"b","d");
So it outputs a,d,c,b,e,f,g,h (b and d have swapped places).

If anyone has code that can do this or some sort of starting point for me I would be very thankful.
__________________
Stuff4Web.co.uk - The ultimate resource for webmasters

50% off all orders £1-£50! Just enter the code AGSIG01 at the checkout! Offer ends: 01/09/2008
markster is offline   Reply With Quote