I am trying to find whether the value roomTypeFilter exists within an Object inside an array. I then want to perform conditional statements depending whether the value roomTypeFilter exists or not.
Below is my code
function includes(k) {
for (var i = 0; i < this.length; i++) {
if (this[i] === k || (this[i] !== this[i] && k !== k)) {
return true;
}
}
return false;
}
var dayValue = this.ui.dayConstraintList.val();
var arr = [courseTemplate.get('dayConstraints')[dayValue]];
console.log(arr);
arr.includes = includes;
console.log(arr.includes('roomTypeFilter'));
The first console.log returns an Object inside an array.
The second console.log returns false, in this case as roomTypeFilter exists inside the Object I want to return 'true' but I am unsure how to do so, any help would be greatly appreciated.

hasOwnPropertyconsole.log(!arr.filter(d => d.hasOwnProperty('roomTypeFilter')).length);