JavaScript Math cos() methodThe JavaScript math cos() method returns the cosine of the given number. The value returned by cos() method ranges -1 to 1, which represents the cosine of the angle. SyntaxThe cos() method is represented by the following syntax: Parameternum - A number. ReturnThe cosine of a number. JavaScript Math cos() method exampleHere, we will understand cos() method through various examples. Example 1Let's see a simple example of cos() method. Test it NowOutput: 0.5403023058681398 -0.4161468365471424 Example 2In this example, we will use cos() method with negative numbers. Test it NowOutput: 0.5403023058681398 0.8775825618903728 Example 3Let's see cos() method with some different test cases. Test it NowOutput: 1 -1 Example 4Here, you can test cos() method with your own test cases. Test it Now
Next TopicJavaScript Math
|
Javatpoint provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India