# includes method

The `includes` method checks for the presence of an element in an array. The parameter takes the value to search. If there is such an element in the array, then the method returns `true`, and if not, then `false`.

## Syntax

`array.includes(element);`

## Example

Let's check if an element exists in an array:

`let arr = [1, 2, 3, 4, 5]; let res = arr.includes(3); console.log(res);`

The code execution result:

`true`

## Example

Let now the element being checked is not in an array:

`let arr = [1, 2, 3, 4, 5]; let res = arr.includes(6); console.log(res);`

The code execution result:

`false`

## See also

- the `indexOf` method
  that finds the position of an element in an array
- the `at` method
  that returns an array element by its index
- the `match` method
  that searches for matches in a string
- the `search` method
  that performs search

← →
↑
en ru