ฟังก์ชัน hypot() ของออบเจกต์ Math ยอมรับตัวเลขและคืนค่าสแควร์รูทของผลรวมของกำลังสองของตัวเลขที่ระบุ
ไวยากรณ์
ไวยากรณ์ของมันคือดังต่อไปนี้
Math.hypot(12, 58, 66);
ตัวอย่าง
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var result = Math.hypot(12, 58, 66);
document.write("hypot value: "+result);
</script>
</body>
</html> ผลลัพธ์
hypot value: 88.67919710958147