This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Math.tan()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Itโ€™s been available across browsers since โจ2015๋…„ 7์›”โฉ.

Math.tan() ํ•จ์ˆ˜๋Š” ํƒ„์  ํŠธ ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค

์‹œ๋„ํ•ด ๋ณด๊ธฐ

function getTanFromDegrees(degrees) {
  return Math.tan((degrees * Math.PI) / 180);
}

console.log(getTanFromDegrees(0));
// Expected output: 0

console.log(getTanFromDegrees(45));
// Expected output: 0.9999999999999999

console.log(getTanFromDegrees(90));
// Expected output: 16331239353195370

๋ฌธ๋ฒ•

js
Math.tan(x);

๋งค๊ฐœ๋ณ€์ˆ˜

x

๋ผ๋””์•ˆ ๊ฐ๋„๋ฅผ ํ‘œํ˜„ํ•œ ์ˆ˜.

๋ฐ˜ํ™˜ ๊ฐ’

์ฃผ์–ด์ง„ ์ˆ˜์˜ ํƒ„์  ํŠธ ๊ฐ’

์„ค๋ช…

Math.tan() ๋ฉ”์„œ๋“œ๋Š” ๊ฐ๋„์˜ ํƒ„์  ํŠธ ๊ฐ’์„ ํ‘œํ˜„ํ•˜๋Š” ์ˆ˜๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

tan()์€ Math์˜ ์ •์  ๋ฉ”์„œ๋“œ์ด๋ฏ€๋กœ ์‚ฌ์šฉ์ž๊ฐ€ ๋งŒ๋“  Math ๊ฐ์ฒด์˜ ๋ฉ”์„œ๋“œ๊ฐ€ ์•„๋‹Œ ํ•ญ์ƒ Math.tan()์œผ๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค (Math ๋Š” ์ƒ์„ฑ์ž๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค).

์˜ˆ์ œ

Math.tan()์‚ฌ์šฉํ•˜๊ธฐ

js
Math.tan(1); // 1.5574077246549023

Math.tan()ํ•จ์ˆ˜๋Š” ๋ผ๋””์•ˆ ๊ฐ’์œผ๋กœ ๋ฐ›์ง€๋งŒ ๊ฐ๋„๋กœ ์ž‘์—…ํ•˜๋Š” ๊ฒƒ์ด ๋” ์‰ฝ๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค์Œ ํ•จ์ˆ˜๋Š” ๊ฐ๋„๋กœ ๊ฐ’์„ ๋ฐ›์•„์„œ ๋ผ๋””์•ˆ์œผ๋กœ ๋ณ€ํ™˜ํ•˜๊ณ  ํƒ„์  ํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

js
function getTanDeg(deg) {
  var rad = (deg * Math.PI) / 180;
  return Math.tan(rad);
}

๋ช…์„ธ

Specification
ECMAScriptยฎ 2026 Language Specification
# sec-math.tan

๋ธŒ๋ผ์šฐ์ € ํ˜ธํ™˜์„ฑ

๊ฐ™์ด ๋ณด๊ธฐ