JavaScript sin() Method
More "Try it Yourself" examples below.
Definition and Usage
The sin() method returns the sine of a number.
Note: This method returns a value between -1 and 1, which represents the sine of the parameter x.
Browser Support
Method | |||||
---|---|---|---|---|---|
sin() | Yes | Yes | Yes | Yes | Yes |
Syntax
Math.sin(x)
Parameter Values
Parameter | Description |
---|---|
x | Required. A number |
Technical Details
Return Value: | A Number, from -1 to 1, representing the sine of an angle, or NaN if the value is empty |
---|---|
JavaScript Version: | ECMAScript 1 |
More Examples
Example
Return the sine of different numbers:
var a = Math.sin(3);
var b = Math.sin(-3);
var c = Math.sin(0);
var d = Math.sin(Math.PI);
var e = Math.sin(Math.PI / 2);
Try it Yourself »
❮ JavaScript Math Object