How to Check if an Array Includes a Value in JavaScript
In this lesson, we will see how to check if an array includes a value in JavaScript, sometimes we want to check if an array includes a value in JavaScript how we can do that?
The includes() method
To do that we can use the includes() method that returns true if the array includes the value if not it returns false.
const colors = ["blue", "orange", "black", "red"];
console.log(colors.includes("black"));
//true