js已知正切值求角度

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>js已知正切值求角度</title>
</head>

<body>
    JS 已知tan的值,如何求对应的角度
    <br> 也就是谁 tan x = y; 知道y的值,如何求x?
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
    <script>
    function getTanDeg(tan) {
        var result = Math.atan(tan) / (Math.PI / 180);
        result = Math.round(result);
        return result;
    }
    var result = getTanDeg(1);
    console.log(result); // 45度
    </script>
</body>

</html>
原文地址:https://www.cnblogs.com/xutongbao/p/9924805.html