JS empty array is true or false (included JS type conversion table)

When bigwigs and communication suddenly talking about the problem.
It prints a bit in the console.

 [] == ![]    //true

I face the question mark? ? ? ?

 

  

 

So look empty array is false

But the array is an object, the object is not possible is false ah! !
The case of the array is converted to a Boolean value of true

 

Access to information discovery: any value compared to the Boolean value, the value will be converted to both sides of the Number.

Yes it is, but why turn into an empty array value is 0 then?

JavaScript look at a table of type conversion

 

When Number ([]) == false, and it will be based on the table of FIG, content first becomes '0', then compare with false.
and so

Guess you like

Origin www.cnblogs.com/JiAyInNnNn/p/12177369.html