I have a problem passing an Array of Arrays by value. I use slice() to pass a copy of the array, but the original is still modified. Here a small sample:
var test = [[1,2],[3,4]];
function addElement(data) {
$.each(data,function(v,val) {
val.push(1)
});
return data;
};
addElement(test.slice());
What am I doing wrong?
Thanks for your help!