> For the complete documentation index, see [llms.txt](https://chnn-anne.gitbook.io/javascript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chnn-anne.gitbook.io/javascript/array/other-methods.md).

# Other Methods

### IndexOf

Returns the index of the element, or -1 if not found

```javascript
let array = [1,2,3,4,5];
let index = array.indexOf(2);
console.log(index); // 1

array = ['cat', 'dog', 'pig'];
index = array.indexOf('pig');
console.log(index); // 2
```
