ES6 - Math.cos(x) Function



It returns the cosine of x radians.

Syntax

Math.cos(x)      

Parameter

  • X1 − represents a number

Example

console.log("---Math.cos()---") 
console.log("Math.cos(Math.PI): "+Math.cos(Math.PI)) 
console.log("Math.cos(Math.PI/4): "+Math.PI/4)           

Output

---Math.cos()--- 
Math.cos(Math.PI): -1 
Math.cos(Math.PI/4): 0.7853981633974483       
Advertisements