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 offers too many high quality services. Mail us on [email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected]
Duration: 1 week to 2 week