Since nobody has really explained why you were having a problem, I'll add that to the mix.
When you assign an array or an object in javascript to a variable, it assigns a reference to that array/object. It does not make a copy of the array/object. So, then you would have two variables that both point at the same array/object and modifying either one will affect the other (since they both point to the same underlying piece of data).
So, when you had this:
var inc_colors = ['#000','#333','#888']; //global inc_colors
var colors = inc_colors; //local colors
All you have now is two variables that both point to the exact same piece of data. Modify either one and the same result will show via the other variable because they point to the same underlying data.
If you want to make a copy, then have to explicitly make a copy (javascript doesn't do it for you automatically). For an array, the simplest way to make a shallow copy is like this:
var newColors = Array.prototype.slice.call(inc_colors);
So, in your exact code, you could apply that copy like this:
var inc_colors = ['#000','#333','#888']; //global inc_colors
function toggleLegendColors(reverse){
var reverse = reverse || false;
var colors = Array.prototype.slice.call(inc_colors); //local copy of the colors array
if(reverse) colors.reverse(); //reverses inc_colors array as well as colors
...
}