The sin() method in How to use sin method can return the sine of a number, so in this article we will take a closer look at the use of the sin() method.
Let’s first look at the basic syntax of sin:
Math.sin(x)
x represents an angle expressed in radians. Convert the angle to radians by multiplying it by 0.017453293 (2PI/360).
Let’s look at specific examples
The code is as follows
<!DOCTYPE html> <html> <body> <script type="text/javascript"> document.write(Math.sin(3) + "<br />") document.write(Math.sin(-3) + "<br />") document.write(Math.sin(0) + "<br />") document.write(Math.sin(Math.PI) + "<br />") document.write(Math.sin(Math.PI/2)) </script> </body> </html>
The effect is as follows: all numbers are converted into sine numbers.
This article ends here. For more exciting content, you can pay attention to other related column tutorials on the PHP Chinese website! ! !
The above is the detailed content of How to use sin method. For more information, please follow other related articles on the PHP Chinese website!