using the grep() function

using the grep() function

Hey guys im tring to use the grep() function to filter my array but im having problem as the array is returning empty.

what im trying to achive is if the selected category exists in the array then for it to return the relevant rows.

i've tried different variations in the return but im having no luck.  Any advise would be greatful...thanks guys


selected['categories'] =
  1. ["Clothes" , "Footwear" ]
  1. filtered_data = jQuery.grep(data, function(index, item) {
                return ($.inArray(item.category, selected['categories']) > -1);
            });
  2. console.log(filtered_data);