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 8698181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:40:42+00:00 2026-06-13T01:40:42+00:00

Consider the following array: var myArray = [ {ID:1, Name:A}, {ID:2, Name:B}, {ID:3, Name:C},

  • 0

Consider the following array:

var myArray = [ {"ID":1, "Name":"A"}, {"ID":2, "Name":"B"},
                {"ID":3, "Name":"C"}, {"ID":4, "Name":"D"}];

I would like to use JQuery somehow to query for all JSON objects within the array with respect to some given ID.
for example, for the input [{“ID”:3}] (I don’t know the exact format to pass the parameter so I decided it will be an object within an array however any suggestion will be acceptable) the the result will be only the third object – {“ID”:3, “Name”:”C”}.
In other words – I would like to “ask” – give me all objects that their ‘ID’ attribute equals ‘3’.

I have tried JQuery.each fonction, however, it iterates all over the array and i’m making the “validation check” by myself in my function (given as second parameter after the array). Is there any built in JQuery function / use for this issue?

Thanks,
Amit.

  • 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-13T01:40:43+00:00Added an answer on June 13, 2026 at 1:40 am
    arrayWithJustThrees = myArray.filter(function (object) { return object.ID === 3 })
    

    https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following array of objects: class Person { public $name; public $occupation; public
Consider the following array which holds all US stock tickers, ordered by length: $tickers
Consider the following char array: char str[128] = abcd; Are all the remaining uninitialized
Consider the following array: var thingsThatMatter = [ {Colour of hair, High}, {Colour of
Consider this string, var string = "sometext/#a=some_text/#b=25/moretext"; What I would like to do is
consider the following: var service_call_array = { 3 : 'test', 4 : 'more of
Consider the following associative array $arr = Array ( [banana] => 2 [cherry] =>
Java noob question: Consider the following C array and initializer code: struct { int
Consider the following code fragment in VS2010 Beta 1: let array = Array2D.zeroCreate 1000
Consider the following scenario . I have an array of numbers: [ 1,2,3,4 ]

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.