How to Use the Math.sin() Method in JavaScript

02/06/2022

Contents

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

The Math.sin() method

The Math.sin function returns the sine of the angle specified as an argument.
The angle is specified in radians.

The syntax is below.

Math.sin(x)

x: The angle in radians

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

Math.sin(degrees*(Math.PI/180))

For example, to get sin30°, sin45°, and sin60°:

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