DEV Community

Discussion on: The Difference between JavaScript “==” and “===” Comparison Operators

Collapse
 
carlosds profile image
Karel De Smet

On the topic of "double equal", I tend to agree more with Kyle Simpson in You Don't Know JS where he states:

However, if you read his own code, you'll find plenty of examples of coercion, both implicit and explicit! In truth, his angst seems to primarily be directed at the == operation, but as you'll see in this chapter, that's only part of the coercion mechanism.

and

Let's take a different perspective on what implicit coercion is, and can be, than just that it's "the opposite of the good explicit kind of coercion." That's far too narrow and misses an important nuance. Let's define the goal of implicit coercion as: to reduce verbosity, boilerplate, and/or unnecessary implementation detail that clutters up our code with noise that distracts from the more important intent.

For anyone interested in this topic (and the mechanics of Javascript in general), this should be mandatory literature: github.com/getify/You-Dont-Know-JS...