How to use sin in JavaScript

In this article, I will explain use of sin() method in JavaScript.
  • 1703

JavaScript sin() Method

  • sin() method of math object is used to get the sine of a number.

  • sin() method returns a numeric value between -1 and 1.

  • In sin() method, numeric value represents the sine of the parameter.



  • x is a Required number


In the following example show to sin() method returns the sine of numbers.





<h3 style="color:Blue">JavaScript sin() Method Example</h3>

<script type="text/javascript">

    var a = Math.sin(30);

    document.write("First Test sin Value : " + a);

    var b = Math.sin(60);

    document.write("<br />Second Test sin Value : " + b);

    var c = Math.sin(0);

    document.write("<br />Third Test sin Value : " + c);

    var d = Math.sin(Math.PI / 2);

    document.write("<br />Fourth Test sin Value : " + d);





sin method.jpg

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2018 DotNetHeaven. All rights reserved.