I'm using the following for loop and as it is written below it alerts 0, 1, 2, 3, 4, 5, 6, 7, 8 (like it should) but when I uncomment set(buttons, i) it alerts 0, 2, 4, 6, 8.
for(i = 0; i < layerOrder.length; i++){
    alert(i);
    //set(buttons, i);
}
I'm very confused by this behavior because I have always assumed that integers were passed by value and not reference.
Is it possible to modify the for loop index variable in a function method like in my set() method? If so I can focus my time on debugging that.
 
     
     
     
    