JS Built-ins
← Math169 / 215
Mathpowintermediate

Math.pow() β€” Negative Exponent

πŸ“– Usage Example
// Raise base to an exponent
Math.pow(2, 8)    // β†’ 256
Math.pow(4, 0.5)  // β†’ 2

Use Math.pow(base, exp) to compute exponential values; in modern JS the ** operator is preferred.

Math.pow()

Returns the base raised to the exponent power.

Challenge: Use Math.pow(2, -1) to compute 2 to the power of -1.

πŸ’‘ Hints (1)
  • β€’ x^(-1) = 1/x; Math.pow(2, -1) = 1/2 = 0.5