ES6 - Math.atan2() Function
This method returns the arctangent of the quotient of its arguments. The atan2 method returns a numeric value between -pi and pi representing the angle theta of an (x, y) point.
Syntax
Math.atan2(x,y)
Parameter
- x and y − represents a number
Example
console.log("---Math.atan2()---")
console.log("Math.atan2(0): "+Math.atan2(0,1))
console.log("Math.atan2(Math.SQRT1_2): "+Math.atan2(1,1))
Output
---Math.atan2()--- Math.atan2(0): 0 Math.atan2(Math.SQRT1_2): 0.7853981633974483
Advertisements