133
JavaScript Math sin() method
The JavaScript math sin() method returns the sine of the given number. The value returned by sin() method ranges between -1 to 1, which represents the sine of the angle.
Syntax
The sin() method is represented by the following syntax:
Parameter
num – A number.
Return
The sine of the number.
JavaScript Math sin() method example
Here, we will understand sin() method through various examples.
Example 1
Let’s see a simple example of sin() method.
Output:
0.8414709848078965 0.9092974268256817
Example 2
In this example, we will use sin() method with negative numbers.
Output:
-0.8414709848078965 -0.479425538604203
Example 3
Let’s see sin() method with some different test cases.
Output:
0 1.2246467991473532e-16
Example 4
Here, you can test sin() method with your own test cases.
Next TopicJavaScript Math