Ví dụ
RUN
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <h1>Học lập trình miễn phí tại freetuts.net</h1> <button onclick="myFunction()">Run</button> <p id="demo"></p> <script> function myFunction() { var content = '3<sup>4</sup> = ' + Math.pow(3, 4) + '<br>'; content = content + '2<sup>1</sup> = ' + Math.pow(2, 1) + '<br>'; content = content + '3<sup>4.5</sup> = ' + Math.pow(3, 4.5) + '<br>'; content = content + '3<sup>-4</sup> = ' + Math.pow(3, -4) + '<br>'; content = content + '3<sup>abc</sup> = ' + Math.pow(3, 'abc') + '<br>'; content = content + 'abc<sup>4</sup> = ' + Math.pow('abc', 4) + '<br>'; document.getElementById("demo").innerHTML = content; } </script> </body> </html>
PHÓNG TO