[JavaScript] Check whether an array includes a value

Created on November 30, 2026

Use includes() to check whether an array contains the supplied value.

arr = [
  'hello',
  'world',
  'good',
  'bye'
]

console.log(arr.includes('world'))

Output

true
JavaScript