Here is my fiddle: http://jsfiddle.net/sepoto/Zgu9J/1/
I\'m starting with a reverse function:
function reverseArr(input) {
var ret = new Array;
All you have to do is clone your array before you reverse it! :)
The shortest way to type is:
var b = a.slice();
But using concat is correct as well. See:
Javascript fastest way to duplicate an Array - slice vs for loop
If slice does not create a copy for you, you can use numpy arrays and create a deep copy this way:
np.copy(a);
see: http://docs.scipy.org/doc/numpy/reference/generated/numpy.copy.html