I have an array of objects like this:
"users": [
{
"type": "User",
"userId": "5b774905c2b2ac0f33ac4cc7",
"name": "Mike"
},
{
"type": "User",
"userId": "5b77490f3084460f2986bd25",
"name": "Pater"
}
]
Now, I would like to check if my array contains an object with the name "Mike".
How do I go about this in javascript?
I am thinking something like this, but not sure how:
if ( "Mike" in users ) {
// Do something...
}
Hoping for help on this, and thanks in advance ;-)