Echo JS 0.11.0

<~>

tracker1 2901 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 2903 days ago. link 1 point
No reason to use === in cases like name == 'joe' or someList.length == MAX_LENGTH
ilyavf 2897 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 2914 days ago. link -1 point
An extremely useful exception: apiOutput.someKey == null
janisk 2906 days ago. link 1 point
wouldn't a simple !apiOutput.someKey give the same result?
sylvainpv 2900 days ago. link 3 points
not if you consider false as a different value than undefined/null