The sin() method returns the sine of a number.
The sin() method returns the sine of a number.
This method returns a value between -1 and 1, which represents the sine of the parameter x.
Math.sin(x)
Parameter | Require | Description |
---|---|---|
x | Required. | A number |
A Number, from -1 to 1, representing the sine of an angle
NaN if the value is empty
Return the sine of a number:
//display the sine value of 3. console.log(Math.sin(3));// w w w .j a va 2 s . c om //Return the sine of different numbers: var a = Math.sin(3); var b = Math.sin(-3); var c = Math.sin(0); var d = Math.sin(Math.PI); var e = Math.sin(Math.PI / 2); var x = a + "\n" + b + "\n" + c + "\n" + d + "\n" + e; console.log(x);