Below is the example of the Math sin() Method.
- Example:
<scripttype="text/javascript">document.write("When zero is passed as a parameter: "+ Math.sin(0));</script>chevron_rightfilter_none - Output:
When zero is passed as a parameter: 0
The Math.sin() method in Javascript is used to return the sine of a number. The Math.sin() method returns a numeric value between -1 and 1, which represents the sine of the angle given in radians.
The sin() is a static method of Math, therefore, it is always used as Math.sin(), rather than as a method of a Math object created.
Syntax:
Math.sin(value)
Parameters: This method accepts a single parameter as mentioned above and described below:
value which is a number given in radians.
Return Value: The Math.sin() method returns the sine of the given numbers.
Below examples illustrates the Math sin() method in JavaScript:
- Example 1:
Input : Math.sin(0) Output : 0
- Example 1:
Input : Math.sin(1) Output : 0.8414709848078965
- Example 1:
Input : Math.sin(Math.PI / 2) Output : 1
More codes for the above method are as follows:
Program 1: When 1 is passed as a parameter.
<script type="text/javascript"> document.write("Result : " + Math.sin(1)); </script> |
Output:
Result : 0.8414709848078965
Program 2: When PI is passed as a parameter.
<script type="text/javascript"> document.write("Result : " + Math.sin(Math.PI / 2)); </script> |
Output:
Result : 1
Supported Browsers:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- JavaScript Math abs( ) Method
- JavaScript Math pow( ) Method
- JavaScript Math cos( ) Method
- JavaScript Math tan( ) Method
- JavaScript Math max() Method
- JavaScript Math min( ) Method
- JavaScript Math log( ) Method
- JavaScript Math exp( ) Method
- JavaScript Math trunc( ) Method
- JavaScript Math floor() Method
- JavaScript Math sqrt( ) Method
- JavaScript Math cosh() Method
- JavaScript Math atanh( ) Method
- JavaScript Math acosh() Method
- JavaScript Math asinh() Method
- JavaScript Math atan( ) Method
- JavaScript Math tanh() Method
- JavaScript Math random() Method
- JavaScript Math asin( ) Method
- JavaScript Math acos( ) Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


