I\'m implementing search functionality into my application. The search results in the UI are returned based on an array of objects. Essentially what I\'m trying to do is ite
function searchObj(search){
let answer = [];
result.forEach(re => {
if(JSON.stringify(re).indexOf(search) > 0){
answer.push(re)
}
});
return answer;
}
Loop through every element of the array, convert them into a string and use indexOf to find the matching criteria. That way you can save a few loops without looping each and every key of every element.