sin (JavaScript)

Gets the sine of an angle.

Defined in

Math (JavaScript)

Syntax

sin(value:double) : double
Parameter Description
value An angle in radians. See below for special cases. See rad (JavaScript) to convert degrees to radians.
Return value Description
double The sine of the parameter.

Usage

Special cases are as follows:
  • The sine of NaN or infinity is NaN.
  • The sine of +0 is positive zero.
  • The sine of -0 is negative zero.

Examples

This button onclick event calculates the two legs of a right triangle given an angle in degrees and the length of the hypotenuse.
sessionScope.a = 
	Math.sin(Math.rad(sessionScope.angleA)) * sessionScope.h;
sessionScope.b = 
	Math.cos(Math.rad(sessionScope.angleA)) * sessionScope.h