Home >>JavaScript Math Reference >JavaScript sin() Method
JavaScript Math.sin() method in JavaScript is used to return a numeric value between -1 and 1, which represents the sine of the angle. Sin() is a static method of a Math, you always used it as Math.sin(), rather than you created as a method of a math object.
Syntax:Math.sin(value)
Parameter | Description |
---|---|
x | It required a number |
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
sin() | Yes | Yes | Yes | Yes | Yes |
<html> <body> <button onclick="mySin()">Click me</button> <p id="sin"></p> <script> function mySin() { document.getElementById("sin").innerHTML = Math.sin(8); } </script> </body> </html>
<html> <body> <script> document.write("Output : " + Math.sin(0)); </script> </body> </html>