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

  • Home
  • SEARCH
  • 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 7614199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:20:35+00:00 2026-05-31T02:20:35+00:00

Using jQuery, how do I iterate through an array of objects and return the

  • 0

Using jQuery, how do I iterate through an array of objects and return the one that meets certain criteria?

  • 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-05-31T02:20:36+00:00Added an answer on May 31, 2026 at 2:20 am

    You can use the jQuery grep function:

    var matches = jQuery.grep(array, function(item) {
        // this is a reference to the element in the array
        // you can do any test on it you want
        // return true if you want it to be in the resulting matches array
        // return false if you don't want it to be in the resulting matches array
    
        // for example: to find objects with the Amount property set to a certain value
        return(item.Amount === 100);
    });
    // matches contains all objects that matches
    if (matches.length) {
        // first match is in matches[0]
    }
    

    If your condition you want to test for is anything other than a strict equality, then you will have to use some sort of array iteration that executes your custom comparison. You could do it with .each() or with .grep() depending upon what type of output you want.

    If you condition was a strict equality, you could use jQuery.inArray().

    Obviously, you don’t need jQuery for this as you could just iterate through the array yourself in plain javascript and implement whatever test you wanted. One advantage of using plain javascript is that you can break out of the iteration when you’ve found the result you want.

    In regular javascript:

    for (var i = 0, len = array.length; i < len; i++) {
        if (array[i].Price === 100) {
            // match is in array[i]
            break;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to iterate through table, using JQuery, and collect in three different arrays values
Using jquery, how can I iterate through all elements in a given class?
I'm trying to iterate through a bunch of variables in a javascript (using jQuery)
I am dynamically building an array of objects using a process that boils down
How do I iterate through a PHP array in jQuery? I have an array
I am attempting to iterate through a HTML table using jQuery and delete empty
I am using jQuery to iterate through a Javascript object and I would like
I am trying to iterate through a table using the jquery .each function as
Using jQuery I'm creating a basic 'tooltip' animation so that the tooltip will appear
Using jQuery 1.2.x and jQuery UI 1.5.x, one was able to trigger dragging manually

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.