# Array.prototype.includes

### `Array.prototype.includes()`

`includes` 返回`true` 如果数组中存在某个元素

```javascript
let array = [1,2,4,5];

array.includes(2);
// true
array.includes(3);
// false
```

## 额外用法

`includes` 第二参数可以加入起始查找的索引（涵盖这个起始值）。默认情况下，是0。

```javascript
let array = [1,3,5,7,9,11];

array.includes(3,1);
// find the number 3 starting from array index 1
// true
array.includes(5,4);
//false
array.includes(1,-1);
// find the number 1 starting from the ending of the array going backwards
// false
array.includes(11,-3);
// true
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mm.ricky.moe/javascript/es6-han-shu/array.prototype.includes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
