Its syntax is:
|Math.cos( x )|
where x is any number.
Here is the code:
var i = Math.cos(30);
document.write("The cos value of 30: " + i);
var j= Math.cos(90);
document.write("The cos value of 90: " + j);
<h2>Use of method cos()</h2>
<button onclick="calculate()">Show Cos value</button>
Output will be displayed as:
On clicking the button, the cosine values of the specified numbers will be displayed:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.