Which fix removes the bug?
const ids = [4, 8, 15];
if (ids.contains(8)) {
console.log('found');
}
- Call
ids.has(8) - Call
ids.includes(8) - Write
8 in ids - Call
ids.contains?.(8)
Arrays have no contains method; includes is the membership test (has is for Set and Map).
Play Problem Solving ▸