Skip to content

Instantly share code, notes, and snippets.

@AitorAlejandro
Created March 13, 2022 16:52
Show Gist options
  • Save AitorAlejandro/56163326a26b44ff629fadcb2bd288fc to your computer and use it in GitHub Desktop.
Save AitorAlejandro/56163326a26b44ff629fadcb2bd288fc to your computer and use it in GitHub Desktop.
Get the max prop value from an object array
const objectList = [
{ value: 1 },
{ value: 2 },
{ value: 3 },
{ value: 4 },
{ value: 5 }
];
const maxValue = Math.max(...objectList.map(x => x.value));
// maxValue -> 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment