The Math.atan2() function returns the angle in radians between the positive x-axis and the ray from (0,0) to the point (x,y), for Math.atan2(y,x).
Math.atan2() is passed separate x and y arguments, and Math.atan()
is passed the ratio of those two arguments.
Math.atan2(y, x)
let a = Math.atan2(9, 15); console.log(a);//from w ww. ja v a 2s.c o m a = Math.atan2(15, 9); console.log(a);