Math

Math.sin

Returns the sine of a number in radians

Syntax

JavaScript
Math.sin(x)

Parameters

ParameterTypeDescription
xnumberAn angle in radians

Return Value

The sine of x, between -1 and 1

Examples

Basic Usage
console.log(Math.sin(0)); // 0
console.log(Math.sin(Math.PI / 2)); // 1
Practical Example
const degrees = 90;
const radians = degrees * (Math.PI / 180);
console.log(Math.sin(radians)); // 1
Advanced Usage
const wave = Array.from({ length: 10 }, (_, i) =>
  Math.sin(i * 0.5).toFixed(2)
);
console.log(wave);

Understanding Math.sin

The Math.sin method in JavaScript returns the sine of a number in radians. It belongs to the Math object and is one of the most widely used methods for working with math values in modern JavaScript and TypeScript applications.

The method signature is Math.sin(x). It accepts 1 parameter: x. When called, it returns the sine of x, between -1 and 1. Understanding when and how to use sin() helps you write more expressive, readable code.

Common use cases for Math.sin include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like math-cos, math-tan, math-pi, enabling you to chain operations together for complex data manipulation pipelines.

Browser support for Math.sin is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.

Browser Compatibility

Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.

Related Methods

More Math Methods

Other methods in the Math object

Related Tools

More Math Methods

Explore JavaScript Methods

Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.