Update allEqual.md

Resolve #964
This commit is contained in:
Angelos Chalaris
2019-05-24 10:19:25 +03:00
committed by GitHub
parent 905402226a
commit 1d612fecc3

View File

@ -3,6 +3,7 @@
Check if all elements in an array are equal.
Use `Array.prototype.every()` to check if all the elements of the array are the same as the first one.
Elements in the array are compared using the strict comparison operator, which does not account for `NaN` self-inequality.
```js
const allEqual = arr => arr.every(val => val === arr[0]);