Vanilla JS - Get the max prop value from an object array in JavaScript

This is a quick example of how to get the maximum value of a property in an array of objects in JavaScript.

The below code snippet uses the following three Vanilla JS tools to get the max prop value from an array:

  • the function to create a new array that contains only the property we're interested in (.value)
  • the ES6 Spread Operator (...) to expand/convert the array into a list of arguments that can be passed to a function as input parameters
  • the Math.max() function to get the largest value from the input parameters
const arrayOfObjects = [
    { value: 1 },
    { value: 2 },
    { value: 3 },
    { value: 4 },
    { value: 5 }
const maxValue = Math.max( => x.value));

Run the example vanilla JS on StackBlitz at

More info on JavaScript functions used

For more info on the Vanilla JS functions and operator used in the example see the below links:


Need Some Vanilla JS Help?

Search fiverr to find help quickly from experienced Vanilla JS developers.

Exclusive Semrush Special Offer

FREE 14-day PRO trial to Semrush is available to visitors of this blog. Check your website health quickly and easily with the Semrush all-in-one site auditing tool, eliminate technical SEO issues and optimize your website's speed and performance.

Supported by