I have generated an array and now I am filtering it (with grep(), which I have never used before). Out of the matching results I need the FareIDs to display the divs that carry these IDs, but I don't know how to get to them.
function FilterFares() {
$(".samplediv").hide();
var matchingFares = $.grep(Fares, function(e) {
return e.Segment == Segment && e.DepartureTime >= DepartureTime_Min && e.DepartureTime <= DepartureTime_Max;
});
console.log(matchingFares); // OK
console.log(matchingFares.FareID); // HOW CAN I GET TO THIS VALUE ??
}
AND... how can I filter the same line for another Segment (in my example the Segment is 0 or 1, but there can be many more). How do I extend the grep function for that?
THANKS!