```
$.each(subcategories, function(index, subcategory) {
  if (subcategory['id'] == subcategory_id) {
    has_sub = true;
  }
});
```

```
subcategories = get_subcategories_for(category_id, attribute_array);
return _.any(subcategories, function() {
  return subcategory['id'] == subcategory_id;
});
```