For your specific case you can do like this:
const results = searchTerm && searchTerm2 ? people.filter(person => person.name.toLowerCase().includes(searchTerm.toLocaleLowerCase()) && person.address.toLowerCase().includes(searchTerm2.toLocaleLowerCase()) ) : people
However, note that the filter won't be applied unless both search terms are present.
Yah but that is exactly what i don't want. I want that the user can choose one of the filters or both of them in the sametime
Hello! In the end you found the solution?
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
For your specific case you can do like this:
However, note that the filter won't be applied unless both search terms are present.
Yah but that is exactly what i don't want. I want that the user can choose one of the filters or both of them in the sametime
Hello! In the end you found the solution?