# How to Use the Math.cos() Method in JavaScript

02/06/2022

Contents

In this article, you will learn how to use the Math.cos() method in JavaScript.

## The Math.cos() method

The Math.cos function returns the cosine of the angle specified as an argument.

The angle is specified in radians.

The syntax is below.

```
Math.cos(x)
```

x: The angle in radians

If you want to use angles in degrees, you need to convert them to radians.

`Math.cos(degrees*(Math.PI/180))`

For example, to get cos30°, cos45°, and cos60°:

```
Math.cos(30*(Math.PI/180));
Math.cos(45*(Math.PI/180));
Math.cos(60*(Math.PI/180));
```