Within my array of objects, the structure is as follows:
var locations = [
[{id: 1, lat: 51.52376322544537, lng: 5.13785702262885, content: 'Title A'}],
[{id: 2, lat: 51.52358632767757, lng: 5.137921395645208, content: 'Title B'}],
[{id: 3, lat: 51.52343946863126, lng: 5.138093057022161, content: 'Title C'}],
];
To access the id's, I currently employ this method:
if (id === 7 || id === 13 || id === 15 || id === 16) {
marker.setIcon(icon4);
}
I attempted a shorter approach like so:
if (id.toString().indexOf(['7','13','15','16'] > -1)) {
}
However, this method is not functioning properly. If anyone can offer guidance on a more efficient solution, it would alleviate my frustration with the current code implementation.