JavaScript find min value in an array of objects | Example code

Use JavaScript reduce() or Math method to get the min value in an array of objects. Using the Math functions with the spread operator (…) and sorting the array numerically with .sort() is way to get min value form array.

JavaScript find min value in an array of objects Examples

HTML example codes:-

Using apply() and map() method

Program of gets the minimum value of y property by using apply() and map() method.

Using reduce() Method

Example code for how to gets the minimum value of y property by using reduce() method. It returns the whole object.

Using map(), Math, and the spread operator

You can create a function to get max and min from Array.

Output: Result will be same because Array object values are same.

JavaScript find min value in an array of objects

Do comment if you have any doubts and suggestions on this Array topic.

Note: All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.