From de24745a0a2227d5794738926f3359b65792d3cb Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Tue, 11 Jan 2022 02:14:34 +0900 Subject: Number オブジェクトのプロパティ・メソッドの記事を変換準備 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global_objects/number/toexponential/index.html | 89 ---------------------- .../global_objects/number/toexponential/index.md | 89 ++++++++++++++++++++++ 2 files changed, 89 insertions(+), 89 deletions(-) delete mode 100644 files/ja/web/javascript/reference/global_objects/number/toexponential/index.html create mode 100644 files/ja/web/javascript/reference/global_objects/number/toexponential/index.md (limited to 'files/ja/web/javascript/reference/global_objects/number/toexponential') diff --git a/files/ja/web/javascript/reference/global_objects/number/toexponential/index.html b/files/ja/web/javascript/reference/global_objects/number/toexponential/index.html deleted file mode 100644 index e76e3417a8..0000000000 --- a/files/ja/web/javascript/reference/global_objects/number/toexponential/index.html +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: Number.prototype.toExponential() -slug: Web/JavaScript/Reference/Global_Objects/Number/toExponential -tags: - - JavaScript - - Method - - Number - - Prototype -translation_of: Web/JavaScript/Reference/Global_Objects/Number/toExponential ---- -
{{JSRef}}
- -

toExponential() メソッドは {{jsxref("Number")}} オブジェクトを指数表記で表した文字列を返します。

- -
{{EmbedInteractiveExample("pages/js/number-toexponential.html")}}
- - - -

構文

- -
numObj.toExponential([fractionDigits])
- -

引数

- -
-
fractionDigits
-
任意です。小数点の後の桁数を指定する整数です。既定値はその数を表すのに必要な数の桁です。
-
- -

返値

- -

{{jsxref("Number")}} オブジェクトを、指数表記 (小数点前は 1 桁、小数点の後は fractionDigits によって指定された桁で切り捨て) で表した文字列です。

- -

例外

- -
-
{{jsxref("RangeError")}}
-
fractionDigits が小さすぎたり大きすぎたりした場合。 0 以上 20 以下の値では {{jsxref("RangeError")}} が発生しません。実装によっては、より大きな値や小さな値に対応しているかもしれません。
-
{{jsxref("TypeError")}}
-
このメソッドが {{jsxref("Number")}} ではないオブジェクトに対して呼び出された場合。
-
- -

解説

- -

fractionDigits 引数が省略された場合、小数点の後の桁数は、その値を特定するのに必要な桁数になります。

- -

toExponential メソッドを 1 つの数値リテラル、または、指数も小数点もない数値リテラルに対して使用する場合、ドットが小数点として解釈されることを防ぐために、メソッド呼び出しに先立つドットの前に空白を置いてください。

- -

引数 fractionDigits で指定された桁よりも多くの桁を持っている数の場合、その数は、fractionDigits の桁で表すことができる最も近い数で表されます。{{jsxref("Number.prototype.toFixed", "toFixed()")}} メソッドの説明における概数表現の説明を参照してください。それは、toExponential メソッドにも適用されます。

- -

- -

toExponential の使用

- -
var numObj = 77.1234;
-
-console.log(numObj.toExponential());  // 7.71234e+1 を表示
-console.log(numObj.toExponential(4)); // 7.7123e+1 を表示
-console.log(numObj.toExponential(2)); // 7.71e+1 を表示
-console.log(77.1234.toExponential()); // 7.71234e+1 を表示
-console.log(77 .toExponential());     // 7.7e+1 を表示
-
- -

仕様書

- - - - - - - - - - - - -
仕様書
{{SpecName('ESDraft', '#sec-number.prototype.toexponential', 'Number.prototype.toExponential')}}
- -

ブラウザーの互換性

- -

{{Compat("javascript.builtins.Number.toExponential")}}

- -

関連情報

- - diff --git a/files/ja/web/javascript/reference/global_objects/number/toexponential/index.md b/files/ja/web/javascript/reference/global_objects/number/toexponential/index.md new file mode 100644 index 0000000000..2c5fa812f6 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/number/toexponential/index.md @@ -0,0 +1,89 @@ +--- +title: Number.prototype.toExponential() +slug: Web/JavaScript/Reference/Global_Objects/Number/toExponential +tags: + - JavaScript + - メソッド + - Number + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Number/toExponential +--- +
{{JSRef}}
+ +

toExponential() メソッドは {{jsxref("Number")}} オブジェクトを指数表記で表した文字列を返します。

+ +
{{EmbedInteractiveExample("pages/js/number-toexponential.html")}}
+ + + +

構文

+ +
numObj.toExponential([fractionDigits])
+ +

引数

+ +
+
fractionDigits
+
任意です。小数点の後の桁数を指定する整数です。既定値はその数を表すのに必要な数の桁です。
+
+ +

返値

+ +

{{jsxref("Number")}} オブジェクトを、指数表記 (小数点前は 1 桁、小数点の後は fractionDigits によって指定された桁で切り捨て) で表した文字列です。

+ +

例外

+ +
+
{{jsxref("RangeError")}}
+
fractionDigits が小さすぎたり大きすぎたりした場合。 0 以上 20 以下の値では {{jsxref("RangeError")}} が発生しません。実装によっては、より大きな値や小さな値に対応しているかもしれません。
+
{{jsxref("TypeError")}}
+
このメソッドが {{jsxref("Number")}} ではないオブジェクトに対して呼び出された場合。
+
+ +

解説

+ +

fractionDigits 引数が省略された場合、小数点の後の桁数は、その値を特定するのに必要な桁数になります。

+ +

toExponential メソッドを 1 つの数値リテラル、または、指数も小数点もない数値リテラルに対して使用する場合、ドットが小数点として解釈されることを防ぐために、メソッド呼び出しに先立つドットの前に空白を置いてください。

+ +

引数 fractionDigits で指定された桁よりも多くの桁を持っている数の場合、その数は、fractionDigits の桁で表すことができる最も近い数で表されます。{{jsxref("Number.prototype.toFixed", "toFixed()")}} メソッドの説明における概数表現の説明を参照してください。それは、toExponential メソッドにも適用されます。

+ +

+ +

toExponential の使用

+ +
var numObj = 77.1234;
+
+console.log(numObj.toExponential());  // 7.71234e+1 を表示
+console.log(numObj.toExponential(4)); // 7.7123e+1 を表示
+console.log(numObj.toExponential(2)); // 7.71e+1 を表示
+console.log(77.1234.toExponential()); // 7.71234e+1 を表示
+console.log(77 .toExponential());     // 7.7e+1 を表示
+
+ +

仕様書

+ + + + + + + + + + + + +
仕様書
{{SpecName('ESDraft', '#sec-number.prototype.toexponential', 'Number.prototype.toExponential')}}
+ +

ブラウザーの互換性

+ +

{{Compat("javascript.builtins.Number.toExponential")}}

+ +

関連情報

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