Why does !{}[true] evaluate to true in JavaScript?

前端 未结 10 1462
一个人的身影
一个人的身影 2020-12-12 17:55

{}[true] is [true] and ![true] should be false.

So why does !{}[true] evaluate to true

10条回答
  •  执念已碎
    2020-12-12 18:11

    You're not reversing the value of it.

    ![true] != [!true]
    

    Check this out: Why is !true ? 'false' : 'true' returning 'true'?

提交回复
热议问题