remove from array in returning removed item:
const removeUser = id => {
const index = users.findIndex((user) => user.id === id)
if (index !== -1) {
return users.splice(index, 1)[0]
}
}
find item with longest length(only one of them)
f.sort((a,b)=>{return b.length - a.length })[0]