0

How to test whether an array includes a certain value among its entries in JavaScript

JavaScript
const arr = [1, 2, 3];
console.log(arr.includes(2)); // true

const pets = ['cat', 'dog', 'bat'];
console.log(pets.includes('cat')); // true
console.log(pets.includes('at')); // false
RUN
add comment
Suggest a different solution or add another example