A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Math/cos below:

Math.cos() - JavaScript | MDN

Math.cos()

Baseline Widely available

Die statische Methode Math.cos() gibt den Kosinus einer Zahl im Bogenmaß zurück.

Probieren Sie es aus
function getCircleX(radians, radius) {
  return Math.cos(radians) * radius;
}

console.log(getCircleX(1, 10));
// Expected output: 5.403023058681398

console.log(getCircleX(2, 10));
// Expected output: -4.161468365471424

console.log(getCircleX(Math.PI, 10));
// Expected output: -10
Syntax Parameter
x

Eine Zahl, die einen Winkel im Bogenmaß darstellt.

Rückgabewert

Der Kosinus von x, zwischen -1 und 1, einschließlich. Wenn x Infinity, -Infinity oder NaN ist, wird NaN zurückgegeben.

Beschreibung

Da cos() eine statische Methode von Math ist, verwenden Sie sie immer als Math.cos() und nicht als Methode eines von Ihnen erstellten Math-Objekts (Math ist kein Konstruktor).

Beispiele Verwendung von Math.cos()
Math.cos(-Infinity); // NaN
Math.cos(-0); // 1
Math.cos(0); // 1
Math.cos(1); // 0.5403023058681398
Math.cos(Math.PI); // -1
Math.cos(2 * Math.PI); // 1
Math.cos(Infinity); // NaN
Spezifikationen Browser-Kompatibilität Siehe auch MDN-Feedback-Box War diese Übersetzung hilfreich?

Diese Seite wurde automatisch aus dem Englischen übersetzt.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4