运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Math</h1> <h2>The Math.sin() Method</h2> <p>Math.sin() returns the sine of a number given in radians:</p> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = "Sine of 0 degrees is: " + Math.sin(0).toFixed(2) + "<br>" + "Sine of 30 degrees is: " + Math.sin(Math.PI/6).toFixed(2) + "<br>" + "Sine of 90 degrees is: " + Math.sin(Math.PI/2).toFixed(2) + "<br>" + "Sine of 180 degrees is: " + Math.sin(Math.PI).toFixed(2) + "<br>" + "Sine of 210 degrees is: " + Math.sin(Math.PI*3/2).toFixed(2) + "<br>" + "Sine of 360 degrees is: " + Math.sin(Math.PI*2).toFixed(2); </script> </body> </html>