--- title: Math.tan() slug: Web/JavaScript/Reference/Global_Objects/Math/tan tags: - JavaScript - Math - Method - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Math/tan --- <div>{{JSRef}}</div> <p>Die <strong><code>Math.tan()</code></strong> Funktion gibt den Tangens einer Zahl.</p> <div>{{EmbedInteractiveExample("pages/js/math-tan.html")}}</div> <h2 id="Syntax">Syntax</h2> <pre class="syntaxbox"><code>Math.tan(<var>x</var>)</code></pre> <h3 id="Parameter">Parameter</h3> <dl> <dt><code>x</code></dt> <dd>Eine Zahl im Winkelmaß (rad).</dd> </dl> <h3 id="Rückgabewert">Rückgabewert</h3> <p>Den Tangens der übergebenen Zahl.</p> <h2 id="Beschreibung">Beschreibung</h2> <p>Die <code>Math.tan()</code> Funktion gibt einen numerischen Wert zurück, welcher den Tangens eines Winkels repräsentiert.</p> <p>Weil <code>tan()</code> eine statische Funktion von <code>Math</code> ist, wird es immer als <code>Math.tan()</code> eingesetzt<code>,</code> jedoch nicht als Methode eines erzeugten <code>Math</code> Objektes (<code>Math</code> ist kein Konstruktor).</p> <h2 id="Beispiele">Beispiele</h2> <h3 id="Einsatz_von_Math.tan()">Einsatz von <code>Math.tan()</code></h3> <pre class="brush: js">Math.tan(1); // 1.5574077246549023 </pre> <p>Weil die <code>Math.tan()</code> 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ß: </p> <pre class="brush: js">function getTanDeg(deg) { var rad = deg * Math.PI/180; return Math.tan(rad); } </pre> <h2 id="Spezifikationen">Spezifikationen</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Spezifikation</th> <th scope="col">Status</th> <th scope="col">Kommentar</th> </tr> <tr> <td>{{SpecName('ES1')}}</td> <td>{{Spec2('ES1')}}</td> <td>Initiale Definition. Implementiert in JavaScript 1.0.</td> </tr> <tr> <td>{{SpecName('ES5.1', '#sec-15.8.2.18', 'Math.tan')}}</td> <td>{{Spec2('ES5.1')}}</td> <td> </td> </tr> <tr> <td>{{SpecName('ES6', '#sec-math.tan', 'Math.tan')}}</td> <td>{{Spec2('ES6')}}</td> <td> </td> </tr> <tr> <td>{{SpecName('ESDraft', '#sec-math.tan', 'Math.tan')}}</td> <td>{{Spec2('ESDraft')}}</td> <td> </td> </tr> </tbody> </table> <h2 id="Browserkompatibilität">Browserkompatibilität</h2> <p>{{Compat("javascript.builtins.Math.tan")}}</p> <h2 id="Siehe_auch">Siehe auch</h2> <ul> <li>{{jsxref("Math.acos()")}}</li> <li>{{jsxref("Math.asin()")}}</li> <li>{{jsxref("Math.atan()")}}</li> <li>{{jsxref("Math.atan2()")}}</li> <li>{{jsxref("Math.cos()")}}</li> <li>{{jsxref("Math.sin()")}}</li> </ul>