How to Check if an Array Contains a Value in Javascript

 In this tutorial, you’ll learn how to check if an array contains a value in JavaScript.

So, let get started...

1) Check if an array contains a string or number

To check if an array contains a string or number value, you can use the array method like array.includes()

const fruit= ['apple', 'banana', 'avocado'];
const result = fruit.includes('banana');

console.log(result); // true