JS Built-ins
ObjectObject.isbeginner

Object.is() β€” same value returns true

πŸ“– 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() β€” identical primitives

For most values, Object.is(a, b) behaves the same as ===. Two identical primitives return true.

Challenge: Implement sameValue(a, b) that returns Object.is(a, b).

sameValue(1, 1)       // β†’ true
sameValue('x', 'x')  // β†’ true
πŸ’‘ Hints (1)
  • β€’ For most values, `Object.is` and `===` agree. The exceptions are `NaN` and `Β±0`.