EmbraceLife/lastResortJS

CoLearning: Highlights

Opened this issue · 1 comments

=== vs ==

  • Date: 2019.9.5
  • 3 best answers at SO
  • test1, test2
  • in general === is faster than ==, but not stable for some reason.
fsifl commented

I think === is faster than == is because the == allows type coercion, which will take more time.
The stability issue might come from the cases where no type coercion happens, then the == is actually the same as ===.
I learned it from Kyle Simpson, a teacher of FrontEnd Master, the author of You Don't Know JS: https://github.com/getify/You-Dont-Know-JS/tree/1st-ed. (a deep dive into javascript, worthy to read, at least give me a view why JS is very weird somehow!)