allEqualBy
Checks if all elements in an array are equal, based on the provided mapping function.
- Apply
fnto the first element ofarr. - Use
Array.prototype.every()to check iffnreturns the same value for all elements in the array as it did for the first one. - Elements in the array are compared using the strict comparison operator, which does not account for
NaNself-inequality.