How to check if an array contains a value in JavaScript

It’s really nice to know whether or not an item is contained within your array. There is too many ways to detect if an Array in javascript contains a specific Value, my favourite on is that we can check this array using the includes() function .

for example:

[1, 2, 3].includes(1); // true

Maher Gallaoui

You like our Content? Follow us to stay up-to-date.