Array Reverse
Jul 7
I recently came in need of a way to reverse the order of the elements in my array. Here's what I came up with.
2 hint="reverses the order of the array"
3 output="false"
4{
5 var j = arrayLen(arguments.inputArray);
6
7 for (var i=1;i<=arrayLen(arguments.inputArray)/2;i++) {
8 arraySwap(arguments.inputArray,i,j--);
9 }
10
11 return arguments.inputArray;
12}