JS Built-ins
← Math139 / 215
Mathlogintermediate

Math.log() β€” log(0) = -Infinity

πŸ“– Usage Example
// Natural logarithm (base e)
Math.log(1)        // β†’ 0
Math.log(Math.E)   // β†’ 1

Use Math.log() to compute the natural logarithm of a positive number.

Math.log()

Returns the natural logarithm (base e) of a number.

Challenge: Observe that Math.log(0) returns -Infinity.

πŸ’‘ Hints (1)
  • β€’ The natural log approaches -∞ as x approaches 0 from the right