Calculates the mode (most frequent numeric value) of a specified property in an array of objects.
The type of objects in the array.
The array of objects.
The key whose numeric values will be used.
The mode value, or NaN if no valid numbers are found.
const data = [{ a: 1 }, { a: 2 }, { a: 2 }, { a: 3 }];modeBy(data, 'a'); // Returns 2 Copy
const data = [{ a: 1 }, { a: 2 }, { a: 2 }, { a: 3 }];modeBy(data, 'a'); // Returns 2
Calculates the mode (most frequent numeric value) of a specified property in an array of objects.