Math.tan()
Die Math.tan()
Funktion gibt den Tangens einer Zahl.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Syntax
Math.tan(x)
Parameter
x
- Eine Zahl im Winkelmaß (rad).
Rückgabewert
Den Tangens der übergebenen Zahl.
Beschreibung
Die Math.tan()
Funktion gibt einen numerischen Wert zurück, welcher den Tangens eines Winkels repräsentiert.
Weil tan()
eine statische Funktion von Math
ist, wird es immer als Math.tan()
eingesetzt,
jedoch nicht als Methode eines erzeugten Math
Objektes (Math
ist kein Konstruktor).
Beispiele
Einsatz von Math.tan()
Math.tan(1); // 1.5574077246549023
Weil die Math.tan()
Funktion Werte im Winkelmaß erwartet, es aber oftmals einfacher ist mit Winkeln zu rechnen, nutzt die folgende Funktion Winkel (in Grad) und Convertiert diese in das Winkelmaß:
function getTanDeg(deg) {
var rad = deg * Math.PI/180;
return Math.tan(rad);
}
Spezifikationen
Spezifikation | Status | Kommentar |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Standard | Initiale Definition. Implementiert in JavaScript 1.0. |
ECMAScript 5.1 (ECMA-262) Die Definition von 'Math.tan' in dieser Spezifikation. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) Die Definition von 'Math.tan' in dieser Spezifikation. |
Standard | |
ECMAScript (ECMA-262) Die Definition von 'Math.tan' in dieser Spezifikation. |
Lebender Standard |
Browserkompatibilität
BCD tables only load in the browser
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.