如何在JavaScript中获取数字的切线?
要在JavaScript中获取数字的切线,请使用Math.tan()方法。此方法返回数字的切线。tan方法返回代表角度切线的数值。
示例
您可以尝试运行以下代码来获取数字的切线-
<html>
<head>
<title>JavaScript Math tan() Method</title>
</head>
<body>
<script>
var value = Math.tan( -30 );
document.write("First Value : " + value );
var value = Math.tan( 90 );
document.write("<br />Second Value : " + value );
var value = Math.tan( 45 );
document.write("<br />Third Value : " + value );
var value = Math.tan( Math.PI/180 );
document.write("<br />Fourth Value : " + value );
</script>
</body>
</html>