Math.cos()

ES1+

Returns the cosine of a number (in radians).

Syntax

Math.cos(x)

Parameters

x number

A number in radians

Return Value

number

The cosine of the given number

Examples

JavaScript
console.log(Math.cos(0));
console.log(Math.cos(Math.PI));
console.log(Math.cos(Math.PI * 2));
Output:
// 1 -1 1

Related Methods