0

Hi I have this code in javascript :

actFinal: function(fecha,datos,rut,nombre){


    var self = this;
    var aFinalDos = new Array();

        $.each(datos, function(index,value){ 
            var date = value.start.substring(0,10);
            $.each(self.aControlesEditados, function(index2,value2){
                var aFinal = new Array();
                var date2 = value2.fecha.substring(0,10);
               if(date2 == date){
                    aFinal.push(value.start,value.estado)
                    aFinalDos.push(aFinal)
               }
            });

        });

        console.info(aFinalDos);

},

And the code print this :

enter image description here

(arrays could be more , but in this case are 6 , and I need show 3)

I need remove the duplicates, I mean ,I only need this :

enter image description here

How can I fix this? sorry my english.

1 Answer 1

2

UnderscoreJS has an array function called unique, which produces a duplicate-free array.

Only thing - I'm not sure if it will work in this case - because you have array of arrays.

Take a look here: http://underscorejs.org/#uniq

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.