I have the following Object and I want to check if Type.ID contains value 6508 :
{
"item": {
"Feature": [
{
"ID": 85408,
"Status": {
"ID": 65,
},
"Type": {
"ID": 6508,
"Volume": null
},
"Manufacturer": null
},
{
"ID": 85409,
"Status": {
"ID": 65,
},
"Type": {
"ID": 6509,
"Volume": null
},
"Manufacturer": null
}
],
"Errors": {
"Result": 0,
"Message": ""
},
"RecordCount": 2
}
}
I can muster the following:
for (i = 0; i < data.item.Feature.length; i++) {
if (data.item.Feature[i].Type.ID == 6508)
return true;
}
return false;
How can I use underscore.js to do the same? The following doesn't work?
_.contains(data.item.Feature.Type.ID, 6508)