Quick JavaScript Question for Developers Do you think this is true or false? [] == ![] I actually came across this while working on a feature. At one point, my condition was behaving in a way I didn’t expect… and this was the reason behind it. 👉 The result is: true Why is it true? It looks like a small thing…But the impact? [] is truthy → so ![] becomes false Now it becomes: [] == false JavaScript then converts both sides to numbers: false → 0 [] → "" → 0 So finally: 0 == 0 → true Always prefer === to avoid these surprises #javascript #coding #webdevelopment #developers #js
True
Almost never should you use == Default to === unless you know explicitly you only want 2