JavaScript Math.sin()
Definition and Usage
The Math.sin() method returns the sine of a number.
Note: Math.sin(x) returns a value between -1 and 1, which represents the sine of the parameter x.
Example 2
let a = Math.sin(3);
let b = Math.sin(-3);
let c = Math.sin(0);
let d = Math.sin(Math.PI);
let e = Math.sin(Math.PI / 2);
Try it Yourself »
Browser Support
Math.sin()
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
Syntax
Math.sin(x)
Parameters
Parameter | Description |
---|---|
x | Required. A number |
Return Value
A number (from -1 to 1) representing the sine of an angle. NaN if the value is empty. |