JS Built-ins
← Number104 / 105
NumbervalueOfintermediate

valueOf() β€” used implicitly in arithmetic

πŸ“– Usage Example
// Retrieve the primitive numeric value
const n = new Number(42)
n.valueOf()          // β†’ 42
typeof n.valueOf()   // β†’ 'number'

Use valueOf() on a Number object to extract the underlying primitive number value, which JavaScript also calls automatically in numeric expressions.

valueOf() in Arithmetic

When a Number object is used in arithmetic, JavaScript calls valueOf() implicitly.

πŸ’‘ Hints (1)
  • β€’ JavaScript implicitly calls `valueOf()` when a `Number` object is used in numeric operations.