Hi this is my question:

Can an Array be equal to a function that returns an Array and receives an Array as argument, been this Array the same original Array.

Please take a look at my code.
I need to filter an Array of Arrays twice to get an Array with a single Array, based on the values that are different.

To accomplish that I have create a filter function that receives 3 arguments, the array(which is actually an Object), the argument(which is a property of the Object), and the value (of the property) Im looking for.

The funny thing is that in IE and FF it is not working, but in Safari it only works the first time.

My code looks like this.

// I create this array beacuse I dont whant to destroy the original
var mod = Array();

alert("Modelos vacio:" + mod.length); //returns 0

for (i=0; i < supermodelos[$("#modelo").val()].modelos.length; i++){

// alert returns 6 for yaris
alert("Modelos lleno:" + mod.length);

mod = removeDifferent(mod, cilindrada, cil);
// breaks in FF y IE, should returns 3 for yaris 1.3

alert("Modelos misma cilindrada:" + mod.length);
mod = removeDifferent(mod, transmision, tran);

// breaks in Safari, should returns 1 for yaris 1.3 automatico
alert("Modelos misma transmision:" + mod.length);

function removeDifferent(array, argumento, valor) {
for(var i = 0; i < array.length; i++) {
if(array[i].argumento != valor) {
return array;

full code can be seen in