Need to know if something's in your array? Use includes, just like with strings:
const guests = ["Olivia", "Lucas", "Sofia"];
console.log(guests.includes("Lucas"));
console.log(guests.includes("Buggsy"));
It prints
true false
Perfect for a bouncer at a party. "Is your name on the list?"
Need to know where it is? Use indexOf, which gives the index of the first match, or -1 if it's not there:
const guests = ["Olivia", "Lucas", "Sofia"];
console.log(guests.indexOf("Sofia"));
console.log(guests.indexOf("Buggsy"));
It prints
2 -1
(Sorry, Buggsy. You're not on the list.)