A RetroSearch Logo

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

Search Query:

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

Math.sin() - JavaScript | MDN

Math.sin()

Baseline Widely available

Math.sin() 静的メソッドは、ラジアンの数値の正弦 (サイン) を返します。

試してみましょう
function getCircleY(radians, radius) {
  return Math.sin(radians) * radius;
}

console.log(getCircleY(1, 10));
// Expected output: 8.414709848078965

console.log(getCircleY(2, 10));
// Expected output: 9.092974268256818

console.log(getCircleY(Math.PI, 10));
// Expected output: 1.2246467991473533e-15
構文 引数
x

ラジアンで角度を表す数値です。

返値

x の正弦(サイン)で、 -1 と 1 の両端を含む範囲です。 x が Infinity であった場合は -Infinity となり、 NaN であった場合は NaN を返します。

解説

sin() は Math の静的メソッドであるため、生成した Math オブジェクトのメソッドとしてではなく、常に Math.sin() として使用するようにしてください (Math はコンストラクターではありません)。

例 Math.sin() の使用
Math.sin(-Infinity); // NaN
Math.sin(-0); // -0
Math.sin(0); // 0
Math.sin(1); // 0.8414709848078965
Math.sin(Math.PI / 2); // 1
Math.sin(Infinity); // NaN
仕様書 ブラウザーの互換性 関連情報

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