vendredi 29 mai 2015

How to compare two arrays to see how many same elements they have?

I have two arrays, one is answers, and second one is correctAnswers and i need to see how many elements in answers are the same as in array of correctAnswers and to get percent how many "answers" are "correct". How do i do that? The arrays are something like this:

 answers = ["Hrtkovci","Lepenica","Dec"]

 correctAnswers = ["Lepenica","Dec","Leskovac"]

And i dont know if it matters but everything is with angular.

Aucun commentaire:

Enregistrer un commentaire