I am trying to return a number that represents the similarity between two arrays.
I.e :
Array1: {Katy, Jenny, Sarah, Ben, Jill, Tina}
Array2: {Katy, John, Sam, Ben, Jill, Linda}
I want to return the number 3 because three comparisons are correct. Is this
possible? I can’t think of any functions that will do this for me.
This is how you can count the amount of items that are equal in matching indices.
Note that you might want to assure that you don’t try to access arr2 in an index that is out of range:
If you don’t care about index positions, you should use nemesv’s solution.