Sometimes you see of frameworks like ReactJS uses
Object.is(), and how can you think of it?
It really is just the same as
=== except two cases:
> 0 === -0 true > Object.is(0, -0) false > NaN === NaN false > Object.is(NaN, NaN) true
Object.is() works just like
=== except these two cases, so next time when you see
Object.is(), you can think of it roughly equivalent to
=== except these two minor details.
This is in fact the comparison method used in ReactJS Hooks, such as
useEffect(), where the dependency array elements are compared using
Top comments (0)