THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

JavaScript sin() Method

Math Object Reference JavaScript Math Object

Example

Return the sine of a number:

Math.sin(3);

The result will be:

0.1411200080598672
Try it yourself »

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: 1.0

Examples

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);

The result of a,b,c,d, and e will be:

0.1411200080598672
-0.1411200080598672
0
1.2246063538223772e-16
1
Try it yourself »

Math Object Reference JavaScript Math Object