- Instant help with your JavaScript coding problems

Check if an array contains a value

Question:
How to check if an array contains a value?
Answer:
const myArray = [1,2,3];

myArray.includes(1);
Description:

You can check if an array contains the given value in JavaScript by using the includes method.

Share "How to check if an array contains a value?"