I have an array in the following format:
var markers = [
['Title', 15.102253, 38.0505243, 'Description', 1],
['Another Title', 15.102253, 38.0505243, 'Another Description', 2],
['Title 3', 15.102253, 38.0505243, 'Description 3', 3],
];
I then have a query string being passed to the page (m=1,2), which being comma separated, is then split to create an array like the following:
['1', '2']
What I need to do is find all ‘markers’ where the ID (markers[i][4]) comes from the query string.
What would be the best way to achieve this? Ideally I want to create a 3rd array in the same format as ‘markers’ but only showing the results from the query string.
Any help would be greatly appreciated.
Thanks
One option is to use nested loops:
DEMO: http://jsfiddle.net/3TErD/