JavaScript has a complex relationship with equality. It is common knowledge that using === is preferable to == because it gives more predictable results, and in most cases === behaves as expected. Unfortunately, due to quirks in the JavaScript type system, there are some frustrating edge cases. In this recipe, we'll see how to use Object.is to get expected results for comparisons.
Using Object.is to compare two values
Getting ready
This recipe assumes you already have a workspace that allows you to create and run ES modules in your browser. If you don't, please see the first two chapters.