Math.sin( ) In JavaScript
The Math.sin() function 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.
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 function accepts a single parameter value which is a number given in radians.
Return Value: The Math.sin() function returns the sine of the given numbers.
Examples:
Input : Math.sin(0)
Output : 0
Input : Math.sin(1)
Output : 0.8414709848078965
Input : Math.sin(Math.PI / 2)
Output : 1
- Example: When zero is passed as a parameter.
<scripttype="text/javascript">document.write("Output : " + Math.sin(0));</script>chevron_rightfilter_noneOutput:
Output : 0
- Example 2: When 1 is passed as a parameter.
<scripttype="text/javascript">document.write("Output : " + Math.sin(1));</script>chevron_rightfilter_noneOutput:
Output : 0.8414709848078965
- Example 3: When PI is passed as a parameter.
<scripttype="text/javascript">document.write("Output : " + Math.sin(Math.PI / 2));</script>chevron_rightfilter_noneOutput:
Output : 1
Supported Browsers: The browsers supported by JavaScript Math.sin( ) function are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- Introduction to JavaScript Course | Learn how to Build a task tracker using JavaScript
- JavaScript Course | Understanding Code Structure in JavaScript
- JavaScript Course | Printing Hello World in JavaScript
- JavaScript Course | Logical Operators in JavaScript
- JavaScript Course | Conditional Operator in JavaScript
- JavaScript Course | Data Types in JavaScript
- JavaScript Course | Objects in JavaScript
- JavaScript Course | JavaScript Prompt Example
- JavaScript Course | Loops in JavaScript
- JavaScript Course | Variables in JavaScript
- JavaScript Course | Functions in JavaScript
- JavaScript Course | Operators in JavaScript
- JavaScript vs Python : Can Python Overtop JavaScript by 2020?
- How to include a JavaScript file in another JavaScript file ?
- JavaScript | Let
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.



