X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

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 »


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

Internet Explorer Firefox Opera Google Chrome Safari

The sin() method is supported in all major browsers.


Syntax

Math.sin(x)

Parameter Values

Parameter Description
x Required. A number

Return Value

Type Description
Number A Number, from -1 to 1, representing the sine of an angle, or NaN if the value is empty

Technical Details

JavaScript Version: 1.0


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

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook