sin

Returns the sine of a number.

Applies to

Math

Syntax

sin(x)

Parameters

x

A number.

Description

The sin method returns a numeric value between -1 and 1, which represents the sine of the argument.

sin is a static method of Math. As a result, you always use it as Math.sin(), rather than as a method of a Math object you create.

Examples

The following function returns the sine of the variable x:

function getSine(x) {
      return Math.sin(x)
}

If you pass getSine the value Math.PI/2, it returns 1.

See also

Math:acos, Math:asin, Math:atan, Math:atan2, Math:cos, Math:tan