I would like for someone to explain this to me:
function myFunction(array){
array = $.grep(array, function(n,i){return n > 1 });
}
var mainArray = [1,2,3];
myFunction(mainArray);
document.write(mainArray) // 1,2,3, but i'm expecting 2,3
but if i do something like
array[3] = 4;
in place of the $.grep
line, i get 1,2,3,4
. Shouldn't mainArray
become the new array created by $.grep
?