JS Built-ins
← Math128 / 215
Mathhypotbeginner

Math.hypot() β€” Single Zero

πŸ“– Usage Example
// Euclidean distance / hypotenuse
Math.hypot(3, 4)   // β†’ 5
Math.hypot(5, 12)  // β†’ 13

Use Math.hypot() to calculate the hypotenuse of a right triangle or Euclidean distance between points.

Math.hypot()

Returns the square root of the sum of squares of its arguments.

Challenge: Verify that Math.hypot(0) returns 0.

πŸ’‘ Hints (1)
  • β€’ sqrt(0^2) = sqrt(0) = 0