From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../reference/global_objects/math/sqrt2/index.html | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 files/ja/web/javascript/reference/global_objects/math/sqrt2/index.html (limited to 'files/ja/web/javascript/reference/global_objects/math/sqrt2/index.html') diff --git a/files/ja/web/javascript/reference/global_objects/math/sqrt2/index.html b/files/ja/web/javascript/reference/global_objects/math/sqrt2/index.html new file mode 100644 index 0000000000..a2796d9df3 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/math/sqrt2/index.html @@ -0,0 +1,66 @@ +--- +title: Math.SQRT2 +slug: Web/JavaScript/Reference/Global_Objects/Math/SQRT2 +tags: + - JavaScript + - Math + - Property + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Math/SQRT2 +--- +
{{JSRef}}
+ +

Math.SQRT2 プロパティは、 2 の平方根、約 1.414 を表します。

+ +

Math.SQRT2=21.414\mathtt{\mi{Math.SQRT2}} = \sqrt{2} \approx 1.414

+ +
{{EmbedInteractiveExample("pages/js/math-sqrt2.html", "shorter")}}
+ + + +
{{js_property_attributes(0, 0, 0)}}
+ +

解説

+ +

SQRT2Math オブジェクトの静的プロパティなので、 Math オブジェクトを生成してプロパティとして使用するのではなく、常に Math.SQRT2 として使用するようにしてください (Math はコンストラクターではありません)。

+ +

+ +

Math.SQRT2 の使用

+ +

以下の関数は 2 の平方根を返します。

+ +
function getRoot2() {
+  return Math.SQRT2;
+}
+
+getRoot2(); // 1.4142135623730951
+
+ +

仕様書

+ + + + + + + + + + + + +
仕様書
{{SpecName('ESDraft', '#sec-math.sqrt2', 'Math.SQRT2')}}
+ +

ブラウザーの互換性

+ + + +

{{Compat("javascript.builtins.Math.SQRT2")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf