Home  >  Article  >  Web Front-end  >  How to use sin method

How to use sin method

不言
不言Original
2019-02-12 16:26:465729browse

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.

How to use 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.

How to use sin method

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn