--- title: Math.tan() slug: Web/JavaScript/Reference/Global_Objects/Math/tan tags: - 레퍼런스 - 메소드 - 수학 - 자바스크립트 translation_of: Web/JavaScript/Reference/Global_Objects/Math/tan ---
Math.tan() 함수는 탄젠트 값을 반환합니다
Math.tan(x)
x주어진 수의 탄젠트 값
Math.tan() 메소드는 각도의 탄젠트 값을 수로 반환합니다.
tan()은 Math의 정적 메서드이므로 사용자가 만든 Math 객체의 메서드가 아닌 항상 Math.tan()으로 사용합니다 (Math 는 생성자가 아닙니다).
Math.tan()Math.tan(1); // 1.5574077246549023
Math.tan()함수는 라디안 값으로 받지만 각도로 작업하는 것이 더 쉽기 때문에 다음 함수는 각도로 값을 받아서 라디안으로 변환하고 탄젠트를 반환합니다.
function getTanDeg(deg) {
var rad = deg * Math.PI/180;
return Math.tan(rad);
}
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('ES1')}} | {{Spec2('ES1')}} | Initial definition. Implemented in JavaScript 1.0. |
| {{SpecName('ES5.1', '#sec-15.8.2.18', 'Math.tan')}} | {{Spec2('ES5.1')}} | |
| {{SpecName('ES6', '#sec-math.tan', 'Math.tan')}} | {{Spec2('ES6')}} | |
| {{SpecName('ESDraft', '#sec-math.tan', 'Math.tan')}} | {{Spec2('ESDraft')}} |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("javascript.builtins.Math.tan")}}