Comparing Values of Objects in JavaScript