Here is my fiddle: http://jsfiddle.net/sepoto/Zgu9J/1/
I'm starting with a reverse function:
function reverseArr(input) {
var ret = new Array;
for(var i = input.length-1; i >= 0; i--) {
ret.push(input[i]);
}
//I tried changing the return value to
//return ret.slice(0) which has no effect on making
//an independent copy
return ret;
}
The second array I make pointOrigins2 is not an independent copy of pointOrigins1. In other words modifying pointOrigins2 is also modifying pointOrigins1 which is not what I need to achieve. From my reading on StackOverflow I have tried a few options such as using slice or using a for loop however nothing seems to be working yet so I made a fiddle.
Is there a way to make an independent copy of the reversed array?