Maybe you would like to use higher-order functions such as “map”.
Assuming you want search by ‘field’ attribute:
var elementPos = array.map(function(x) {return x.id; }).indexOf(idYourAreLookingFor);
var objectFound = array[elementPos];
More Related Contents:
- Why Array.indexOf doesn’t find identical looking objects
- How to find the array index with a value?
- Javascript 2d array indexOf
- Javascript oddness with array of objects and indexOf
- Array value is replaced when second one stores in php
- Javascript Array – Split string at numbers [closed]
- Making new array and push there keys on that new array [closed]
- How do I empty an array in JavaScript?
- How can I add new array elements at the beginning of an array in JavaScript?
- Why is using “for…in” for array iteration a bad idea?
- How can I group an array of objects by key?
- Remove array element based on object property
- How to loop through an array containing objects and access their properties
- Sorting an array of objects by property values
- Convert array of strings into an array of objects
- How to check if an array is a subset of another array in JavaScript?
- Why do I need to copy an array to use a method on it?
- Convert simple array into two-dimensional array (matrix)
- Remove duplicate values from an array of objects in javascript [duplicate]
- Javascript – Sort Array of objects by 2 Properties
- How to use lodash to find and return an object from Array?
- Javascript pushing objects into array changes entire array
- Why is math.max() returning NaN on an array of integers?
- Get the item that appears the most times in an array
- Convert an array to an array of objects
- use Lodash to sort array of object by value
- How to convert array of key–value objects to array of objects with a single property?
- Find closest date in array with JavaScript
- Find last index of element inside array by certain condition
- How to flatten array in jQuery?