Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript sin() Method

JavaScript sin() Method

Math Object Reference JavaScript Math object

Example

Return the sine of a number:

Math.sin(3);

Output result:

0.1411200080598672

Try it »


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 value

Parameters Description
x Required. An angle expressed in radians. Multiply the angle by 0.017453293 (2PI/360) to convert it 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, and LinkedHashMap, among others. e Output result:

0.1411200080598672

-0.1411200080598672

0

1.2246063538223772e-16

1

Try it »


Math Object Reference JavaScript Math object