Math.sin(angle) Last updated: 16. May 2026
Returns the sine of a number in radians. The returned value is between -1 and 1.
Parameters
| Name | Type | Description |
|---|---|---|
| angle | number | A number representing an angle in radians. |
Returns
A number between -1 and 1, representing the sine of the given angle (in radians).
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.function getSinFromDegrees(degrees) {
return Math.sin(degrees * Math.PI / 180);
}
write(Math.sin(0));
write("\n");
write(Math.sin(Math.PI / 2));
write("\n");
write(getSinFromDegrees(90));
/* Expected output:
0
1
1
*/ Output
The JS code above produces the output shown below:0
1
1