Say I have an array of objects arr = []
.
Inside arr
there are many objects, all of the same format, say.
arr = [
{
"a": "asdf",
"b": {
"a": 2,
"b": 1,
"c": 4
},
"c": {
"a": 0,
"b": 1
}
},
{
"a": "xswh",
"b": {
"a": 4,
"b": null,
"c": 8
},
"c": {
"a": 6,
"b": 5
}
}
]
If I have a variable that is an object of the same shape:
obj1 = {
"a": "asdf",
"b": {
"a": 2,
"b": 1,
"c": 4
},
"c": {
"a": 0,
"b": 1
}
}
How can I quickly check to see if this object obj1
is inside the array? (meaning, if inside the array there is an object with the exact same parameters and values.
I tried arr.includes(obj1)
but it didn't seem to work.