The Wayback Machine - https://web.archive.org/web/20221021041547/https://www.geeksforgeeks.org/javascript-math-sin-method/
Skip to content
Related Articles

Related Articles

JavaScript Math sin( ) Method

View Discussion
Improve Article
Save Article
  • Last Updated : 17 Oct, 2022
View Discussion
Improve Article
Save Article

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 is an example of the Math sin() Method.

Example: 

Javascript




<script type="text/javascript">
    cosnole.log("When zero is passed as a parameter: "+ Math.sin(0));
</script>

Output:

When zero is  passed as a parameter: 0

Below examples illustrates the Math sin() method in JavaScript:

Example 1:

Input : Math.sin(0)
Output : 0

Example 2:

Input : Math.sin(1)
Output : 0.8414709848078965

Example 3:

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. 

Javascript




<script type="text/javascript">
        console.log("Result : " + Math.sin(1));
</script>

Output:

Result : 0.8414709848078965

Program 2: When PI is passed as a parameter. 

Javascript




<script type="text/javascript">
        console.log("Result : " + Math.sin(Math.PI / 2));
</script>

Output:

Result : 1

Supported Browsers:

  • Google Chrome 1 and above
  • Internet Explorer 3 and above
  • Firefox 1 and above
  • Opera 3 and above
  • Safari 1 and above

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!