I have an array of objects like this:
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'}],
];
I want to access the id's now i do it like this:
if (id === 7 || id === 13 || id === 15 || id === 16) {
marker.setIcon(icon4);
}
I thought this was a shorter way:
if (id.toString().indexOf(['7','13','15','16'] > -1)) {
}
But this is not working can somebody help me out on this, it is frustrating me because i don't like that code i use.