barValues is an array I'm passing to a function. Within the function I have this:
alert(barValues);
var sortedBarValues = barValues;
sortedBarValues.sort(function(a,b){return b - a});
alert(barValues);
I'm trying to end up with two arrays. barValues being the original array and sortedBarValues being a copy of that array, now sorted.
However, via the two alerts, I'm finding that barValues is ALSO being sorted. Why is that? What is the proper way to make a copy of an array so sort it separately from the original array?