Finds the maximum 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 compared.
The maximum value, or -Infinity if no valid number is found.
const data = [{ a: 5 }, { a: 2 }, { a: 9 }];maxBy(data, 'a'); // Returns 9 Copy
const data = [{ a: 5 }, { a: 2 }, { a: 9 }];maxBy(data, 'a'); // Returns 9
Finds the maximum numeric value of a specified property in an array of objects.