英 [pa?]??
n.腦袋,乒(表示射擊、爆炸聲等的擬聲詞)
javascript pow()方法 語法
作用:返回 x 的 y 次冪的值。
語法:Math.pow(x,y)
參數(shù):x ? ?必需。底數(shù)。必須是數(shù)字。? ? y ? ?必需。冪數(shù)。必須是數(shù)字。? ??
返回:x 的 y 次冪。
說明:如果結(jié)果是虛數(shù)或負數(shù),則該方法將返回 NaN。如果由于指數(shù)過大而引起浮點溢出,則該方法將返回 Infinity。
javascript pow()方法 示例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script type="text/javascript"> //把 pow() 運用到不同的數(shù)字組合上 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> </body> </html>
運行實例 ?
點擊 "運行實例" 按鈕查看在線實例