I have an array of such objects:
myArray = [ {label: "a", value: "100"}, {label: "b", value: "101"}, {label: "c", value: "102"} ...
I want to filter it as follows:
myArrayFiltered = myArray.filter(function(v){ return v["value"] == "101" || v["value"] == "102"});
What will return
myArrayFiltered = [ {label: "b", value: "101"}, {label: "c", value: "102"}]
in this example, but I want to make a filter with an array of values. How can i do this?
javascript jquery arrays filter
Gtantoine
source share