已知坐标求角度

let getAngle = (x, y)=> {
        var l = Math.sqrt(x*x + y*y);
        var a = Math.acos(x/l);
        var ret = a * 180 / Math.PI; //弧度转角度,方便调试
        if (y < 0) {
            return 360 - ret;
        }
        return ret;
    }
 console.log(getAngle(45,-45))