JS Built-ins
ObjectObject.isbeginner

Object.is() β€” distinguishes +0 from -0

πŸ“– Usage Example
// Strict identity that handles edge cases
Object.is(NaN, NaN)   // β†’ true  (unlike ===)
Object.is(0, -0)      // β†’ false (unlike ===)
Object.is(1, 1)       // β†’ true

Use Object.is() for strict value comparison that correctly handles NaN equality and distinguishes +0 from -0.

Object.is() β€” positive and negative zero

Object.is(+0, -0) returns false, unlike +0 === -0 which is true. This is one of the key differences between Object.is and ===.

Challenge: Implement zeroDiff() that returns Object.is(0, -0).

zeroDiff()   // β†’ false  (unlike 0 === -0 which is true)
πŸ’‘ Hints (1)
  • β€’ `Object.is` distinguishes `+0` and `-0` whereas `===` treats them as equal.