According to Firebug console, we have the following in JavaScript:
>>> [''] == ''
true
>>> [''] == ['']
false
Finding Python to be much more logical here, I’d expect it to be the way round. Anyway, I can understand the second one — apparently two different objects never compare equal to each other, — but what is the reason for the first to give true? What string would ['', ''] compare equal to?
It’s comparing the string representation of the array on the left to the string on the right.
Of course you can use the strict comparison operator to avoid this…