//loop through the products, create categories ($20-$40, $40-$60, etc.) function filterProducts(products){ var cat1 = '1-1500', cat2 = '1500-3000'; var currentCat; products.forEach(function (i, j){ if (i.price > 1 && i.price <= 1500){ currentCat = cat1; else if (i.price > 1501 && i.price <= 3000) { currentCat = cat2; } if(filteredProducts[currentCat]){ filteredProducts[currentCat].push(i); } else { filteredProducts[currentCat] = [i] } }; }); } function getActiveFilter(){ $('#myFilter').each(function(){ if($(this).is(':checked')){ //add to activeFilter } }); } function resultFilter(){ var result = []; activeFilter.forEach(function (i, value){ Object.keys(value).forEach(function(j, product){ //add to result }; }); }