Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Math</h1>
<h2>The Math.sin() Method</h2>
<p>Math.sin() returns the sine of an angel given in radians.</p>
<p>To use degrees, convert the degrees to radians first:</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"The sine of  0 degrees is: " +  sine(0) +
"<br>" +
"The sine of 30 degrees is: " +  sine(30) +
"<br>" +
"The sine of 90 degrees is: " +  sine(90) +
"<br>" +
"The sine of 150 degrees is: " +  sine(150) +
"<br>" +
"The sine of 180 degrees is: " +  sine(180) +
"<br>" +
"The sine of 210 degrees is: " +  sine(210) +
"<br>" +
"The sine of 270 degrees is: " +  sine(270) +
"<br>" +
"The sine of 360 degrees is: " +  sine(360);
function sine(degree) {
// radians = degrees * PI / 180
  let x = Math.sin(degree * Math.PI / 180);
  return x.toFixed(2);   
}
</script>
</body>
</html>