Question: Beyond the improved readability, is there any advantage to `includes` over `indexOf`? They seem identical to me.

What is the difference between this

```
var x = [1,2,3].indexOf(1) > -1; //true

```

And this? 

```
var y = [1,2,3].includes(1); //true

```

Answer: 
Technically
-----------

`NaN` will **not be findable** when using **`indexOf`**

```js
[NaN].indexOf(NaN) // => -1 (not found)
[NaN].includes(NaN) // => true

```

`includes` also is of no use **if you want to know at where index the element was found**.

Readability
-----------

`arr.indexOf('blah') !== -1` is **less more readable and maintainable**. On the other hand, `arr.includes('blah')` does what it says and it is obvious that it returns a `boolean`.

Performances
------------

According to [this article](https://ryanpeden.com/javascript-indexof-vs-includes-performance/) on the subject **there are no noticeable difference** although `includes` may be a very little bit slower.

History
-------

`indexOf` was created way before `includes`.
indexOf is the older way to check if something is in the array , the new method is better because you don't have to write a condition for being (-1) , so that's why for use the include() method that returns you a boolean.

```
array.indexOf('something')      // return index or -1
array.includes('something')     // return true of false

```

so for finding index the first one is better but for checking being or not the second method is more useful.