How to check if an array includes an object in JavaScript