I want to check if array contains object or not. I am not trying to compare values just want to check in my array if object is present or not?
Ex.
$arr =
You can use some method which tests whether at least one element in the array passes the test implemented by the provided function.
some
array
test
let arr = [{id: 1}, {id:2}, 'a', 'b']; let exists = arr.some(a => typeof a == 'object'); console.log(exists);