欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JavaScript pow() 方法

定義和用法

pow() 方法可返回 x 的 y 次冪的值。

語法

Math.pow(x,y)
參數(shù) 描述
x 必需。底數(shù)。必須是數(shù)字。
y 必需。冪數(shù)。必須是數(shù)字。

返回值

x 的 y 次冪。

說明

如果結果是虛數(shù)或負數(shù),則該方法將返回 NaN。如果由于指數(shù)過大而引起浮點溢出,則該方法將返回 Infinity。

實例

在下面的例子中,我們將把 pow() 運用到不同的數(shù)字組合上:

<script type="text/javascript">

document.write(Math.pow(0,0) + "<br />")
document.write(Math.pow(0,1) + "<br />")
document.write(Math.pow(1,1) + "<br />")
document.write(Math.pow(1,10) + "<br />")
document.write(Math.pow(2,3) + "<br />")
document.write(Math.pow(-2,3) + "<br />")
document.write(Math.pow(2,4) + "<br />")
document.write(Math.pow(-2,4) + "<br />")

</script>

輸出:

1
0
1
1
8
-8
16
16

TIY

pow()
如何使用 pow() 方法。