问题
why is that? I assumed it's some implicit type conversion at first, but [] == [] is also false.
回答1:
Arrays in javascript are Objects. Objects are compared by identity. So no two objects created by different literals (or by other means) are going to be equal (either strictly (===
) or loosely (==
)).
来源:https://stackoverflow.com/questions/34102957/in-javascript-and-both-returns-false