javascript check if element exists in array of objects