You can check if an array contains a value using the includes() method.
Here’s an example:
const list = [1, 2, 3, 4]
list.includes(1) //true
list.includes(5) //false
You can check if an array contains a value using the includes() method.
Here’s an example:
const list = [1, 2, 3, 4]
list.includes(1) //true
list.includes(5) //false
Join my AI Workshop!
The Web Development BOOTCAMP cohort starts in February 2026