I try to filter some elements from my array. So if the element key is found in array show only those arrays that include that.
{"result":["b", "f", "h"], "model":3, "path":3, "resultnumber":56, "otherproducts":["e"]},
{"result":["b", "f", "j"], "model":3, "path":3, "resultnumber":58, "otherproducts":["e"]},
{"result":["b", "g", "h"], "model":11, "path":3, "resultnumber":59, "otherproducts":[]}
So in this case if my key is "h" it should show only first and third array.
My code looks like this now but I am stuck trying to find a way to display only those.
for (var i = 0; i < s.Data.results.length; i++){
var checkObject = s.Data.results[i].path == 3;
console.log(checkObject);
if (checkObject){
if(option in s.Data.results[i].result){
console.log(s.Data.results[i].result);
}
}
}