JavaScript math hypot() method

The JavaScript math hypot() method is used to get the square root of the sum of the squares of a set of numbers.
Syntax:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Math.hypot(n1,n2,..)
Math.hypot(n1,n2,..)
Math.hypot(n1,n2,..)

Parameters
n1,n2,..: It represents the set of numbers.

Returns
The square root of the sum of the squares of a set of numbers

Example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<body>
<script>
document.writeln(Math.hypot(2,2,1,4));
</script>
</body>
</html>
<!DOCTYPE html> <html> <body> <script> document.writeln(Math.hypot(2,2,1,4)); </script> </body> </html>
<!DOCTYPE html>
<html>
<body>
<script>
document.writeln(Math.hypot(2,2,1,4));
</script>
</body>
</html>