ฟังก์ชัน pow() ของออบเจ็กต์ Math จะรับตัวเลขสองตัวและคืนค่าของอาร์กิวเมนต์แรกยกกำลังอาร์กิวเมนต์ที่สอง
ไวยากรณ์
รูปแบบการใช้งานคือดังนี้
Math.pow(48, 2);
ตัวอย่าง
<html> <head> <title>ตัวอย่าง JavaScript</title> </head> <body> <script type="text/javascript"> var result = Math.pow(48, 2); document.write("ผลลัพธ์ "+result); </script> </body> </html>ผลลัพธ์
ผลลัพธ์ 2304