I have an object which I have created as follows:
$(this).find('li').each(function(){
var $itm = $(this);
localproducts.push({
'dataid' : $itm.attr('data-id'),
'datapackage' : $itm.attr('data-package'),
'packageid' : ($itm.children('.packageid').text())
});
});
now I want to filter the created object localproducts, eg. I want to save all the dataids of items whose packageid is equal to 3 for example. I think it can be done with array filter but not sure how. Any help? thanks!
using
filterusing
eachExample: http://jsfiddle.net/hunter/tqTDQ/