C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Math hypot() methodThe 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. SyntaxThe hypot() method is represented by the following syntax: Math.hypot([num1[, num2[, ...]]]) ParameterNum - A number. ReturnThe square root of sum of the squares of given numbers. JavaScript Math hypot() method exampleHere, we will understand hypot() method through various examples. Example 1Let's see a simple example of hypot() method. <script> document.writeln(Math.hypot(3,4)+"<br>"); document.writeln(Math.hypot(12,5)); </script> Output: 5 13 Example 2Let's see an example of hypot() method with three arguments. <script> document.writeln(Math.hypot(2,3,4)+"<br>"); document.writeln(Math.hypot(-2,-5,-8)); </script> Output: 5.385164807134504 9.643650760992955
Next TopicJavaScript Math
|