I need to loop 2 arrays and see if they have matching objects and if so, add a marker to a map and when i click on it I want to tell the number of total results for matching coordinates which in the following example would be 2. The marker is fine as I am looping the arrays and placing it based on the coordinates but I can't give the total number currencies within the same coordinates.
Therefore I have:
latitude = [{"45.99"},{43.22},{"45.99"}];
longitude = [{"9.22"},{"2.645"},{"9.22"}];
This answer helps a bit, basically it uses filter
but what I would like to do is to check if both arrays have any matching values and place the number of results in a modal.
Currently I do:
$("#results .modal-body").html("Risultati"+" " +longitude.length + "<button id='goToResul' type='button' class='btn btn-danger'>Go to result</button>");
But that would check the length of the whole longitude
array while in the arrays example we have twice 45.99 and 9.22 which means 2 matches.
What might helps is that both longitudes and latitudes follow the same index