Skip to content

Get min and max value from array of objects in JavaScript

This is very similar to finding min/max value from an array of primitive data.

let persons = [{Name:"John",Age:12},{Name:"Joe",Age:5}];
let min = Math.min.apply(null,{return a.Age;}))
   ,max = Math.max.apply(null,{return a.Age;}))

//min - 5 , max - 12
See also  Permutations II - Leetcode Challenge - Python Solution

Leave a Reply

Your email address will not be published. Required fields are marked *

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