Math. hypot() 函式


Math 物件的 hypot() 函式可以接受數字,然後返回給定數字的平方的和的平方根。

語法

其語法如下

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

更新時間:25-6 月 -2020

133 瀏覽量

開始事業

完成課程以獲得認證

開始學習
廣告