I have a JSON feed that includes coordinates and info about the type of business to be listed on a Google Maps canvas. In the JSON feed, the industry field is represented by integers, and can be 1, 2 or both. A less abstract way to present this is that a business can be either a restaurant, retail or both.
I managed the get the toggle working between these 2 types by checking whether the initial array value is equal to first type array value, I but can’t figure out how to handle a situation where a business is both. I have searched for “in” operator in Javascript that can check the presence of a value in array and return true or false but not able to find anything useful.
http://jsfiddle.net/serkanh/BVjGh/16/
Current way of checking the type of business:
for(i=0; i < markers.length; i++){
if(markers[i].category === category){
markers[i].setVisible(true);
}else{
markers[i].setVisible(false);
}
}
If your values are 1 and 2, it should be pretty easy: set the value for both types to 3. And test with