JavaScript sin()Method

Math 对象参考手册JavaScript Math Object

Example

Return the sine of a number:

Math.sin(3);

Output:

0.1411200080598672

Try it Yourself »

Definition and Usage

The sine of parameter x.

Note:The return value is between -1.0 and 1.0.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the sin() method


Syntax

Math.sin(x)

Parameter Values

Parameter Description
x Required. An angle in radians. Multiply the angle by 0.017453293 (2PI/360) to convert degrees to radians.

Return Value

Type Description
Number The sine of parameter x. The return value is between -1.0 and 1.0.

Technical Details

JavaScript Version: 1.0


More Examples

Example

In this example, we will 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);

a,b,c,d, andeOutput:

0.1411200080598672
-0.1411200080598672
0
1.2246063538223772e-16
1

Try it Yourself »


Math 对象参考手册JavaScript Math Object

Other Extensions