Basically I want this to output true:
const array = [{"a": "b"}]
const x = {"a": "b"}
console.log(array.includes(x)) // output is false
I tried to google but I could only find a solution if it was not in array like comparing two dictionaries
For example
// JSON.stringify({"a", "b"}) === JSON.stringify(x)
for(let val of array) {
if(JSON.stringify(val) === JSON.stringify(x)) {
console.log("found")
}
}
Which I could do if I iterate through the entire array to check, but wondering if there is a simpler way.