Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to 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>