JavaScript (ES2026) reference · Math Methods and Constants

JavaScript Math.sin() Method

Return the sine of an angle given in radians. Convert degrees with deg * Math.PI / 180 first.

JavaScript (ES2026) Since ES1

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

Math.sin(x)

Parameters

ParameterDescription
x An angle in radians.

Return value

A number between -1 and 1.

Examples

Degrees to radians firstTry it yourself
const rad = (deg) => (deg * Math.PI) / 180;
console.log(Math.sin(rad(30)).toFixed(4), Math.sin(rad(90)));

Output

0.5000 1
Points on a circleTry it yourself
const points = [0, 1, 2, 3].map((i) => {
  const a = (i * Math.PI) / 2;
  return [Math.round(Math.cos(a)) || 0, Math.round(Math.sin(a)) || 0]; // || 0 turns -0 into 0
});
console.log(points);

Output

[ [ 1, 0 ], [ 0, 1 ], [ -1, 0 ], [ 0, -1 ] ]

Version history

VersionChange
JavaScript ES1Added

Was this page helpful?