I have 2 arrays :
labels = ["water", "sever", "electricity"];
services = [0:[0:"1",1:"sever"], 1:[0:"3",1:"park"], 3:[0:"4",1:"gas"]];
I want to check if ANY of labels
value is in services
or not (True or False).
What is the best way to archive this using jquery?
EDIT 1:
Yes, I made a mistake while asking question, services
is a JSON Object.
UPDATE
Bregi's 2nd solution is what I needed. .some
is fulfilling purpose.
var isInAny = labels.some(function(label) {
return services.some(function(s) {
return s[1] == label;
});
});