[javascript] How to find index of an object by key and value in an javascript array