0

What will this output and why?

author
subina kallyani
easy
2
375
console.log([] == ![]);
Answer

It prints true

![]false because non-empty arrays are truthy.
[] == false → JavaScript coerces both sides:
[] becomes "", which coerces to 0
false coerces to 0
So 0 == 0true.

Click to Reveal Answer

Tap anywhere to see the solution

Revealed

Comments0
    What will this output and why? - typecoercion | EBAT