TLDR; How would you go about making a function that e.g. search for value e.g. in array, but where the property searched for can change?
Example.
const search = (arr, text) =>
{
// What if rather than e.name we wanted to search on e.phone?
// And how could this be passed with the function params?
return arr.find(e => e.name === text)
}