Your question, emphasis mine:
...can you give examples of use cases when you need to use ==
instead of ===
?
This is sort of a loaded question. You can emulate ==
by combining ===
with other code, and as long as you can do that, you never really "need" ==
. This is sort of like asking for cases where you "need" ++
, maybe because you prefer to write it as foo += 1
.
Your title asks a more practical question:
When is it a good idea to use == instead of === in js?
Any time you find yourself emulating the behavior of ==
with ===
, you should probably just be using ==
. This includes most cases where you are converting both sides of the operation to the same type, and then comparing with ===
. That's what ==
is made for, why not use it?