JavaScript Math hypot() method

The JavaScript math hypot() method returns the square root of sum of the squares of given numbers. It returns NaN, if any argument cannot be converted to a number.

Syntax

The hypot() method is represented by the following syntax:

Parameter

Num - A number.

Return

The square root of sum of the squares of given numbers.

JavaScript Math hypot() method example

Here, we will understand hypot() method through various examples.

Example 1

Let's see a simple example of hypot() method.

Test it Now

Output:

5
13

Example 2

Let's see an example of hypot() method with three arguments.

Test it Now

Output:

5.385164807134504
9.643650760992955

Next TopicJavaScript Math