Math.sin() : sin « Math « JavaScript Tutorial






Syntax

math.sin(num)

The sin() method of the Math object is used to calculate the sine of a number.

It returns a numeric value between -1 and 1.

<html>
    <body>
    <script language="JavaScript">
    <!--
    function doMath(){
        var inputNum1=document.form1.input1.value;
        var result = Math.sin(inputNum1);
        document.form1.answer.value = result;
    }
    -->
    </script>
    <form name=form1>
    Enter Number:
    <input type="text" name="input1" size=10>
    <input type="button" value="Calculate" onClick='doMath()'>
    <br>
    The sine is:
    <input type="text" name="answer" size=20>
    </form>
    </body>
    </html>








9.23.sin
9.23.1.Math.sin()