Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8393273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:44:21+00:00 2026-06-09T19:44:21+00:00

I have the following javascript object: Person1.Name = John; Person1.Age = 12; Person2.Name =

  • 0

I have the following javascript object:

Person1.Name = "John";
Person1.Age = 12;

Person2.Name = "Joe";
Person2.Age = 5;

I then have an array of persons, how do I find the Min/Max based on a persons age?

Any solution in Javascript or Jquery is acceptable.

your help is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:44:22+00:00Added an answer on June 9, 2026 at 7:44 pm

    Say your array looks like this:

    var persons = [{Name:"John",Age:12},{Name:"Joe",Age:5}];
    

    then you can:

    var min = Math.min.apply(null, persons.map(function(a){return a.Age;}))
       ,max = Math.max.apply(null, persons.map(function(a){return a.Age;}))
    

    [Edit] Added ES2015 method:

    const minmax = (someArrayOfObjects, someKey) => {
      const values = someArrayOfObjects.map( value => value[someKey] );
      return {
          min: Math.min.apply(null, values), 
          max: Math.max.apply(null, values)
        };
    };
    
    console.log(
      minmax( 
        [ {Name: "John", Age: 12},
          {Name: "Joe", Age: 5},
          {Name: "Mary", Age: 3},
          {Name: "James sr", Age: 93},
          {Name: "Anne", Age: 33} ], 
        'Age') 
    );
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a newbee with javascript and have the following code: <html> <body> <object
I have the following JavaScript data structure. a[] is an array with text strings
I have following resourceBundle Javascript object. var resourceBundle = { en : { MSG1
I have the following JavaScript object. When the window resizes, I want it to
I have the following JavaScript object: { DPI: 66.8213457076566, width: 563.341067, editable: True, pricecat:
I have the following javascript object, somewhat pseudocode: { dateField: new Date(), addMinutes:function(numMinutes) {
I have the following JavaScript array of real estate home objects: var json =
I have the following javascript object containing a multi-value email property: var contact =
I have the following javascript object being returned from a WCF call, this has
Suppose I have the following object in JavaScript: var object = { key1: value1,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.