我有以下数组需要使用 .includes 来检查它们是否是重复或没有的对象。问题是它总是返回 false 所以我不确定是否有正确的方法或 .includes 不能以这种方式使用。
var array_rooms = [{
type: "Heritage",
n: 1
}, {
type: "Hanuono",
n: 1
}, {
type: "Bangon",
n: 1
}, {
type: "Heritage",
n: 1
}]
console.log(array_rooms.includes("Heritage"));
//should return trueRun Code Online (Sandbox Code Playgroud)