I have an array called catalogue which holds 4 items:
packageid, dataid , categoryid and datapackage.
What I want to do is push into the array datai
Use the filter function to filter the result and map to get the ids:
var dataids = (
categoryBtnFilter==0 && packageBtnFilter==0
? catalogue
: catalogue.filter(function(i) {
return i.categoryid=categoryBtnFilter && i.packageid==packageBtnFilter
})
).map(function(i){return i.dataid});
I assume your condition should be something like
if ((packageBtnFilter == 0 && categoryBtnFilter == 0) || this.packageid == packageBtnFilter || this.packageid == categoryBtnFilter) dataids.push(this.dataid);