I need to duplicate and manipulate an array variable, but for some reason when I push a value into the newly created array it is pushing the value into the original array.
function testing (point) {
var newArray = currentChain;
newArray.push(point);
}
In this situation, point is being added to the currentChain variable.
Note that nowhere am I setting currentChain equal to newArray and there are no other variables in the script called newArray. Why would it be behaving this way?
newArrayandcurrentChainpoint to the same array object