To find the maximum y value of the objects in array:

Math.max.apply(Math, array.map(function(o) { return o.y; }))

or in more modern JavaScript:

Math.max(...array.map(o => o.y))

Warning:

This method is not advisable, it is better to use reduce. With a large array, Math.max will be called with a large number of arguments, which can cause stack overflow.

Answer from tobyodavies on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Math › max
Math.max() - JavaScript | MDN
Because max() is a static method of Math, you always use it as Math.max(), rather than as a method of a Math object you created (Math is not a constructor). Math.max.length is 2, which weakly signals that it's designed to handle at least two parameters. js · Math.max(10, 20); // 20 Math.max(-10, -20); // -10 Math.max(-10, 20); // 20 · Array.prototype.reduce() can be used to find the maximum element in a numeric array, by comparing each value: js ·
🌐
danvega.dev
danvega.dev › blog › find-max-array-objects-javascript
How to find the max id in an array of objects in JavaScript
March 14, 2019 - Here you are going to call reduce on the characters array. You will define a accumulator which will accumulate the callback's return value. Every time the callback function is called it will return a value and store it in max. The callback method is looking at the character id and if it's greater than max it returns that, if not it returns max.
🌐
Seanconnolly
seanconnolly.dev › javascript-find-element-with-max-value
How to get the element with the max value in a JavaScript array · Sean Connolly
Let's apply Array.reduce to our use case to find the max value element in our array. const playerWithMostWins = players.reduce( (prev, current) => { return prev.wins > current.wins ? prev : current } ); And if you need to change the logic to the player with the least wins (for the wall of shame?), it's the same function but just with a different comparison function:
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-search-the-max-value-of-an-attribute-in-an-array-object
How To Search The Max Value of an Attribute in an Array Object? - GeeksforGeeks
July 15, 2025 - If the price is greater than the current max, it updates the max with the new value. After the loop finishes, max holds the highest price value. We can find the max value of an attribute by using Math.max.apply() function.
🌐
Medium
medium.com › @amitsharma_24072 › 3-efficient-ways-to-find-maximum-value-in-javascript-arrays-515463ebd17
3 Efficient Ways to Find Maximum Value in JavaScript Arrays | by Amit Sharma | Medium
July 11, 2024 - We can use this method to sort ... => { return b - a; }); const max = arr[0]; console.log(max); // Output: 9 · The Math.max() function is a built-in JavaScript function that takes any number of arguments and returns the maximum ...
🌐
Built In
builtin.com › articles › javascript-array-max
3 Methods to Find the JavaScript Array Max | Built In
Arrays are a versatile structure in JavaScript that holds multiple data types. Find the maximum value in an array using for loop, math.max() and the reduce method.
🌐
CoreUI
coreui.io › answers › how-to-find-the-maximum-value-in-an-array-in-javascript
How to find the maximum value in an array in JavaScript · CoreUI
September 21, 2025 - For objects, use: Math.max(...array.map(item => item.value)). ... Follow Łukasz Holeczek on GitHub Connect with Łukasz Holeczek on LinkedIn Follow Łukasz Holeczek on X (Twitter) Łukasz Holeczek, Founder of CoreUI, is a seasoned Fullstack ...
Find elsewhere
🌐
Medium
rathoreaparna678.medium.com › how-to-get-min-or-max-value-of-a-property-in-a-javascript-array-of-objects-b39c279205b9
How to Get Min or Max Value of a Property in a JavaScript Array of Objects? | by Aparna Rathore | Medium
July 17, 2023 - To get the minimum or maximum value of a specific property in a JavaScript array of objects, you can use the `reduce()` function along with some additional logic. Here’s an example of how you can achieve this: To find the minimum value: ...
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-get-max-id-in-array-of-objects
Get the Max id in an Array of Objects in JavaScript | bobbyhadz
Copied!const arr = [{id: 1}, {id: ... the values from the array get passed as multiple, comma-separated arguments to the Math.max() method....
🌐
TutorialsPoint
tutorialspoint.com › how-to-search-the-max-value-of-an-attribute-in-an-array-object
How to search the max value of an attribute in an array object ?
When working with objects, we often need to search for the max value of an attribute in an array of objects. We can use various javascript inbuilt functions like reduce() method, and map() method and we can also use a simple for loop to search for the max value.
🌐
GeeksforGeeks
geeksforgeeks.org › max-min-value-of-an-attribute-in-an-array-of-objects-in-javascript
Max/Min value of an attribute in an array of objects in JavaScript | GeeksforGeeks
July 13, 2023 - Using new Map() ConstructorThe Map constructor can directly create a Map from an array of key-value pairs. If each object in the array has a specific key-value structure, you can map it accordingly.JavaScriptcon ... Here are the different ways to select min/max dates in an array using JavaScript1.
🌐
Jason Watmore's Blog
jasonwatmore.com › post › 2021 › 09 › 14 › vanilla-js-get-the-max-prop-value-from-an-object-array-in-javascript
Vanilla JS - Get the max prop value from an object array in JavaScript | Jason Watmore's Blog
September 14, 2021 - Run the example vanilla JS on StackBlitz at https://stackblitz.com/edit/vanilla-js-get-max-prop-value-from-object-array. For more info on the Vanilla JS functions and operator used in the example see the below links: Array map function - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
🌐
CodeBurst
codeburst.io › javascript-finding-minimum-and-maximum-values-in-an-array-of-objects-329c5c7e22a2
JavaScript: Finding Minimum and Maximum values in an Array of Objects | by Brandon Morelli | codeburst
August 21, 2017 - Now that we have a simple Array of numbers, we use Math.min() or Math.max() to return the min/max values from our new Y value array. The spread operator allows us to insert an array into the built in function.
🌐
30 Seconds of Code
30secondsofcode.org › home › javascript › array › min and max value of an array
Min and max value of a JavaScript array - 30 seconds of code
December 30, 2023 - For more complex cases, such as finding the min/max value in an array of objects, you will have to use Array.prototype.map().
🌐
Daily Dev Tips
daily-dev-tips.com › posts › javascript-find-min-max-from-array-of-objects
JavaScript find min/max from array of objects
July 17, 2022 - We are very explicit with the above examples by using the curly brackets and returning the object. However, seeing we only have one line, we can write it as the shorthand function like this. const highest = users.reduce((prev, cur) => (cur.age > prev.age ? cur : prev)); const lowest = users.reduce((prev, cur) => (cur.age < prev.age ? cur : prev)); Way shorter, right, but it takes some of the readability in one go. ... We will get shown the following error: TypeError: Reduce of empty array with no initial value.
🌐
EyeHunts
tutorial.eyehunts.com › home › javascript get max value in array of objects | example code
JavaScript get max value in Array of objects | Example code
May 16, 2021 - prev : current })); console.log("Maximum value of y = " + res); </script> Created a function to get max and min from Array. <script> var data = [ { "x": "3/10/2020", "y": 0.02352007 }, { "x": "8/12/2021", "y": 0.0254234 }, { "x": "1/16/2010", "y": 0.02433546 }, { "x": "8/19/2015", "y": 0.0313423457 }]; console.log(JSON.stringify(data)); function getYs(){ return data.map(d => d.y); } function getMinY(){ return Math.min(...getYs()); } function getMaxY(){ return Math.max(...getYs()); } var res = getMaxY(); console.log("Maximum value of y = " + res); </script>
🌐
TutorialsPoint
tutorialspoint.com › top-n-max-value-from-array-of-object-javascript
Top n max value from array of object JavaScript
We have to write a function that takes in this array and returns the top n element of the array in another array (top means the object that has the highest value for duration).