https://www.instagram.com/p/CiAdrQtP6cX/
const users = [
{firstName: "Fabio", lastName:"Bergmann"},
{firstName: "John", lastName:"Robert"},
{firstName: "John", lastName:"Doe"},
{firstName: "Albert", lastName:"Carter"},
]
console.log(filteredItems(users, "fa"));
console.log(filteredItems(users, "be"));
console.log(filteredItems(users, "js"))
function filteredItems(arr, searchTerm){
let answer = [];
searchTerm = searchTerm.toLowerCase();
arr.map(e => {
const firstN = e.firstName.toLowerCase();
const lastN = e.lastName.toLowerCase();
if(firstN.includes(searchTerm) || lastN.includes(searchTerm)){
answer.push(e)
}
})
return answer;
}