Math.cos()

Math.cos(x) → number

Returns the cosine of x.

Returns the cosine of the angle x, given in radians. The result is in the range -1 to 1.

Arguments

NameTypeRequiredDefaultDescription
x number optional — An angle in radians.

Returns

number The cosine of x.

Example

let c = Math.cos(Math.PI); // -1