var index = myArray.map(function(el) {
return el.id;
}).indexOf(4);
For IE below version 9, map need a patch, or just use a loop.
More Related Contents:
- Pick data from array of objects and return new object
- How to get all the values associated with an object in array?
- How to remove all duplicates from an array of objects?
- Convert Array to Object
- Group array of object nesting some of the keys with specific names
- Remove array element based on object property
- Sum similar keys in an array of objects
- Sort array of objects by single key with date value
- How to add an object to an array
- Add property to an array of objects
- How to update an “array of objects” with Firestore?
- Find and remove objects in an array based on a key value in JavaScript
- How can I get the index of an object by its property in JavaScript?
- Why Array.indexOf doesn’t find identical looking objects
- What is the performance of Objects/Arrays in JavaScript? (specifically for Google V8)
- Why do empty JavaScript arrays evaluate to true in conditional structures?
- Create an empty object in JavaScript with {} or new Object()?
- How do I remove an object from an array with JavaScript? [duplicate]
- break array of objects into separate arrays based on a property
- Push Object in Array [duplicate]
- Uncaught TypeError: Object.values is not a function JavaScript
- JavaScript: Remove duplicates of objects sharing same property value
- Filtering array of objects by searching nested object properties
- traversing through JSON string to inner levels using recursive function
- Recursive depth function on an array
- Combining two arrays to form a javascript object
- Lodash create collection from duplicate object keys
- Declaring array of objects
- Node.js – console.log does not show items in array but instead shows [Object]
- How to get all keys with values from nested objects