I have an array in the following format:
var markers = [
[\'Title\', 15.102253, 38.0505243, \'Description\', 1],
[\'Another Title\', 15.102253, 38.05052
One option is to use nested loops:
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],
];
var search = ['1', '2'];
var result = [];
for (var i = 0; i < search.length; i++)
for (var j = 0; j < markers.length; j++)
if (search[i] == markers[j][4]) {
result.push(markers[j]);
break;
}
console.log(result);
DEMO: http://jsfiddle.net/3TErD/