Why [] == [] is false in JavaScript?
问题 I am working on a part of the code where I have an array which looks like [[data]] . The data is rendered on the server side through the Django template engine. So my code looks like this: var data = {{ series|safe }}; // data will be [[]] if no data is present if (data ==[[]]) console.log('no data'); The if always returns false . That means in [[]] == [[]] is false and my test shows that []==[] is false as well. Any descriptions would be appreciated. 回答1: Because == (and === ) test to see if