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: 
The answers and examples were all great. However (at first glance), it made me misunderstood that `includes` will always return `true` when using `undefined`.

Hence I am including the example to elaborate **includes can be used to check for undefined and NaN values** wherelse **indexOf can't**

```js
//Array without undefined values and without NaN values. 
//includes will return false because there are no NaN and undefined values

const myarray = [1,2,3,4]

console.log(myarray.includes(undefined)) //returns false
console.log(myarray.includes(NaN)) //returns false

//Array with undefined values and Nan values.
//includes will find them and return true

const myarray2 = [1,NaN, ,4]

console.log(myarray2.includes(undefined)) //returns true
console.log(myarray2.includes(NaN)) //returns true

console.log(myarray2.indexOf(undefined) > -1) //returns false
console.log(myarray2.indexOf(NaN) > -1) //returns false
```

Summary

* `includes` **can** be used to check for undefined and NaN values in array
* `indexOf` **cannot** be used to check for undefined and NaN values in array
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.