Echo JS 0.11.0

<~>

tracker1 3107 days ago. link 1 point
If you understand how coercion works, you can leverage ==, but for most instances, you should go ahead and be explicit with ===.

The bigger gotchas.

Date (with the same value) won't equate with === as they're separate instances, even if the values match. use (+dtm1 === +dtm2) as this will coerce to a numeric value first.

NaN will not equal NaN... (even with ==), so you will need to account for that (as in above).

There are still a handful of gotchas even with === but they are fewer than with ==.
monotype 3108 days ago. link 1 point
No reason to use === in cases like name == 'joe' or someList.length == MAX_LENGTH
ilyavf 3102 days ago. link 1 point
Why would you recommend this? There is a whole bunch of logic being invoked when you use non-strict comparison, so performance is one of the reasons.
Gnito 3119 days ago. link -1 point
An extremely useful exception: apiOutput.someKey == null
janisk 3111 days ago. link 1 point
wouldn't a simple !apiOutput.someKey give the same result?
sylvainpv 3105 days ago. link 3 points
not if you consider false as a different value than undefined/null