Home > Web Front-end > HTML Tutorial > How to use sin method

How to use sin method

不言
Release: 2019-02-12 16:26:46
Original
5808 people have browsed it

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)
Copy after login

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>
Copy after login

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!

Related labels:
sin
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template