IndexOf Method for Multiple Properties in Object Array
问题 What's the best method to get the index of an object in an object array given multiple of it's properties? Imagine the following example array: var array = [ { color: 'red', shape: 'square', weight: 200 }, { color: 'blue', shape: 'circle', weight: 300 }, { color: 'red', shape: 'circle', weight: 100 } ]; Now I would like to have the indexOf the object which color property is red and shape is circle which, in this example, would be 2 . Ideally the function would return the index of the object