Javascript sort items excluding some specific items
问题 I am trying to sort some items (sort a map) , I can sort it successfully, but I want to exclude some items based on it's attribute Right now I am sorting like this based on attribute - price return (product.attr('active') !== 'f' }).sort(function(pA,pB){ return pB.attr('price') - pA.attr('price'); }); I want to skip some items based on attr('product_id') so the listed product_id's wont be sorted based, and will be returned first. return (product.attr('active') !== 'f' }).sort(function(pA,pB){