I am using .find()
on the following json object, which I've named records:
[
{
"_id": "61f9da9fcc6888f201f722cb",
"firstName": "joe",
"lastName": "jergen",
"email": "joe@outlook.com",
"status": "active",
"amount": "5600"
}
]
I then try to find a user in my object using find():
let userProfile = records.find((x) => (x.email = "peter@google.com"));
When I log userProfile it seems to pull joe@outlook.com still even though the user is not in the object. The desired behaviour would be null/undefined