JavaScript sin() method

Definition and usage

sin() The method returns the sine value of a number.

Note:This method returns a value between -1 and 1, representing the sine of the parameter x.

Instance

Example 1

Returns the sine of a number:

Math.sin(3);

Try it yourself

Example 2

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

Try it yourself

Syntax

Math.sin(x)

Parameter value

Parameter Description
x

Required. The angle in radians.

Multiplying an angle by 0.017453293 (2PI/360) converts it to radians.

Technical details

Return value: The value, ranging from -1 to 1, represents the sine of an angle. If the value is empty, it returns NaN.
JavaScript Version: ECMAScript 1

Browser Support

Method Chrome IE Firefox Safari Opera
sin() Support Support Support Support Support

Related Pages

Tutorial:JavaScript Math