Learning JavaScript? Download my free JavaScript Handbook 🔥

Use the includes() method on the array instance.

For example:

['red', 'green'].includes('red') //true ✅

['red', 'green'].includes('yellow') //false ❌

Edit this page


Here's my latest YouTube video. I talk about work/life balance as a developer: