JS Built-ins
← Math197 / 215
Mathsqrtintermediate

Math.sqrt() β€” sqrt(2) β‰ˆ 1.414

πŸ“– Usage Example
// Square root of a non-negative number
Math.sqrt(16)   // β†’ 4
Math.sqrt(2)    // β†’ 1.4142...

Use Math.sqrt() to compute the square root of a non-negative number.

Math.sqrt()

Returns the square root of a number.

Challenge: Verify that Math.sqrt(2) is approximately 1.4142135623730951.

πŸ’‘ Hints (1)
  • β€’ sqrt(2) is an irrational number β‰ˆ 1.41421356; same as Math.SQRT2