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
console.log(Math.max(1, 3, 2)); // Expected output: 3 console.log(Math.max(-1, -3, -2)); // Expected output: -1 const array = [1, 3, 2]; console.log(Math.max(...array)); // Expected output: 3 ... Zero or more numbers among which the largest value will be selected and returned. The largest of the given numbers. Returns NaN if any of the parameters is or is converted into NaN. Returns -Infinity if no parameters are provided. 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).
🌐
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.
🌐
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.
🌐
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 Developer and entrepreneur with over 25 years of experience. As the lead developer for all JavaScript, React.js, and Vue.js products at CoreUI, they specialize in creating open-source solutions that empower developers to build better and more accessible user interfaces.
🌐
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:
🌐
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
We used the spread syntax (...) in the call to the Math.max() method. The Math.max() method expects comma-separated numbers as parameters, so we can't directly pass it an array. ... We used the spread syntax (...) to unpack the values of the ...
🌐
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().
Find elsewhere
🌐
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 ... 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 value....
🌐
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 - max is initialized to -Infinity, ensuring any value in the array will be larger. It iterates over each object in the array, comparing the value of the specified attribute (obj[attr]) with the current max.
🌐
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 - const maxScore = findMaxValue(data, ‘score’); console.log(maxScore); // Output: 95 ``` In both cases, the `reduce()` function is used to iterate over each object in the array. The initial value (`Infinity` for minimum, `-Infinity` for maximum) is set to ensure that the first comparison sets the initial minimum or maximum value correctly.
🌐
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 ?
const max = array.reduce((prev, current) => (prev.attribute > current.attribute) ? prev : current); Here, the reduce() method allows us to iterate through an array and apply a reduction operation. In this case, we use reduce() to compare the attribute value of each object with the previous maximum value and return the object with the higher attribute value.
🌐
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
🌐
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).
🌐
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 - <script> var array = [ { "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(array)); var res = JSON.stringify(array.reduce(function(prev, current) { return (prev.y > current.y) ? 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>
🌐
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.
🌐
JavaScript in Plain English
javascript.plainenglish.io › how-to-find-the-max-value-of-a-property-in-an-array-of-javascript-objects-b2e0c7dbb2ff
How to Find the Max value of a Property in an Array of JavaScript Objects? | by John Au-Yeung | JavaScript in Plain English
September 18, 2021 - Then we use the spread operator to spread all the values into the Math.max method as arguments. Then we get that max is 0.031004457 since this is the biggest value in the whole list. The reduce method lets us compute a result from an array of items.
🌐
Quora
quora.com › How-can-you-find-the-highest-and-lowest-in-an-array-of-objects-JavaScript-Javascript-arrays-object-average-development
How to find the highest and lowest in an array of objects/JavaScript (Javascript, arrays, object, average, development) - Quora
To find the highest and lowest values in an array of objects in JavaScript, iterate the array while comparing a numeric property (e.g., score, price). Below are concise, idiomatic patterns with examples and trade-offs.