标签: javascript arrays object
我有以下数组
var array1 = [{key:"foo"},{key:"bar"},{key:"baz"}]
和这个物体
var obj = {key:"foo"}
如何检查数组是否包含该对象?
console.log(array1.includes(obj)); //显示为“假”
console.log(array1.includes(obj));