Usage of Math. sin () in JavaScript
This article mainly introduces the Math. sin () method used in JavaScript for rounding. It is the basic knowledge in JS learning. For more information, see
This method returns the sine of a number. The sin method returns a value ranging from-1 to 1, representing the sine of the parameter.
Syntax
?
The following is the detailed information about the parameters:
X: a number
Return Value:
Returns the sine of a number.
Example:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<Html> <Head> <Title> JavaScript Math sin () Method </title> </Head> <Body> <Script type = "text/javascript"> Var value = Math. sin (0.5 ); Document. write ("First Test Value:" + value ); Var value = Math. sin (90 ); Document. write ("<br/> Second Test Value:" + value ); Var value = Math. sin (1 ); Document. write ("<br/> Third Test Value:" + value ); Var value = Math. sin (Math. PI/2 ); Document. write ("<br/> Fourth Test Value:" + value ); </Script> </Body> </Html> |
This produces the following results:
?
1 2 3 4 |
First Test Value: 0.479425538604203 Second Test Value: 0.8939966636005578 Third Test Value: 0.8414709848078965 Fourth Test Value: 1 |