Checks if all elements in an array are equal.
Array.prototype.every()
to check if all the elements of the array are the same as the first one.NaN
self-inequality.const allEqual = arr => arr.every(val => val === arr[0]);
allEqual([1, 2, 3, 4, 5, 6]); // false
allEqual([1, 1, 1, 1]); // true
JavaScript, Array
Checks if all elements in an array are equal, based on the provided mapping function.
JavaScript, Array
Checks if all elements in an array are unique, based on the provided mapping function.
JavaScript, Array
Checks if the provided predicate function returns true
for all elements in a collection.