re: In your opinion, what is the most confusing part of JavaScript? VIEW POST


Type coercion is definitely not obvious in JavaScript

[] == ![] // true 😱

IMHO, don't ever ever ever use == in JavaScript. Always use === instead and forget about type coercion; just explicitly type-cast anything you need to.


It's a very rare case when you work on a project alone. Other developers can use == and it's necessary to understand how type coercion works.

I agree that most of developers consider == as evil. But Kyle Simpson (You don't know JS author) don't hate type coercion. Moreover, he recomments to use == where necessary.

In other words, coercion, especially implicit coercion, has usages where it actually improves the readability of our code.


Code of Conduct Report abuse