JavaScript Math cos() Method Last Updated : 15 Jul, 2024 Comments Improve Suggest changes 1 Likes Like Report The Javascript Math.cos() method is used to return the cosine of a number. The Math.cos() method returns a numeric value between -1 and 1, which represents the cosine of the angle given in radians. The cos() is a static method of Math, therefore, it is always used as Math.cos(), rather than as a method of a Math object created.Syntax: Math.cos(value)Parameters: This function accepts a single parameter as mentioned above and described below: Value: This parameter is a number given in radians.Return Value: The Math.cos() function returns the cosine of the given numbers which range from -1 to 1.Example: This example returns the cosine of 0. JavaScript console.log("The cos of 0 : " + Math.cos(0)); OutputThe cos of 0 : 1 Example 2: This example returns the cosine of 010. JavaScript console.log("Result : " + Math.cos(010)); OutputResult : -0.14550003380861354 Example 3: When 1 is passed as a parameter. JavaScript console.log("Result : " + Math.cos(1)); OutputResult : 0.5403023058681398 Example 4: When PI is passed as a parameter. JavaScript console.log("Result : " + Math.cos(Math.PI)); OutputResult : -1 Example 5: When Input is in degrees (not in radians) JavaScript const degree = 90; console.log( "cos(" + degree + ") = " + Math.cos((Math.PI * degree) / 180)); Outputcos(90) = 6.123233995736766e-17 Supported Browsers:Chrome 51 Edge 15 Firefox 54 Safari 10 Opera 38 Create Quiz Comment S Shubrodeep Banerjee Follow 1 Improve S Shubrodeep Banerjee Follow 1 Improve Article Tags : Misc JavaScript Web Technologies javascript-math JavaScript-Methods +1 More Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)8 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like