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.