Latest web development tutorials

JavaScript sin () method

Math Object Reference JavaScript Math Object

Examples

Returns the sine of number:

Math.sin(3);

Output:

0.1411200080598672

try it"

Definition and Usage

Sine value of the parameter x.

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support sin () method


grammar

Math.sin( x )

Parameter Value

参数 描述
x 必需。一个以弧度表示的角。将角度乘以 0.017453293 (2PI/360)即可转换为弧度。

return value

类型 描述
Number 参数 x 的正弦值。返回值在 -1.0 到 1.0 之间。

technical details

JavaScript version: 1.0


More examples

Examples

In this case, we will return different digital sine:

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, and e output:

0.1411200080598672
-0.1411200080598672
0
1.2246063538223772e-16
1

try it"


Math Object Reference JavaScript Math Object