Array.indexOf()
will only work on objects if the supplied object is exactly the same object you put in.
An exact copy is insufficient, it has to be the exact same object, i.e. there must be some object in the array such that:
arr[i] === obj
You need to show how you retrieved the object.
More Related Contents:
- Why Array.indexOf doesn’t find identical looking objects
- How to get all the values associated with an object in array?
- How to remove all duplicates from an array of objects?
- 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
- 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 do empty JavaScript arrays evaluate to true in conditional structures?
- How do I remove an object from an array with JavaScript? [duplicate]
- break array of objects into separate arrays based on a property
- Getting index of an array’s element based on its properties
- Group by, and sum, and generate an object for each array in JavaScript
- 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
- Javascript pushing objects into array changes entire array
- In an array of objects, fastest way to find the index of an object whose attributes match a search
- Combining two arrays to form a javascript object
- Declaring array of objects
- Node.js – console.log does not show items in array but instead shows [Object]
- Create a dynamic nested object from array of properties
- Converting Array of Objects into Array of Arrays
- Difference between ( for… in ) and ( for… of ) statements?
- Find object having maximum value for the `id` property in an array of objects
- How can I remove an element from a list, with lodash?