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/errors/not_a_codepoint/index.html | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 files/ja/web/javascript/reference/errors/not_a_codepoint/index.html (limited to 'files/ja/web/javascript/reference/errors/not_a_codepoint') diff --git a/files/ja/web/javascript/reference/errors/not_a_codepoint/index.html b/files/ja/web/javascript/reference/errors/not_a_codepoint/index.html new file mode 100644 index 0000000000..c993da422c --- /dev/null +++ b/files/ja/web/javascript/reference/errors/not_a_codepoint/index.html @@ -0,0 +1,55 @@ +--- +title: 'RangeError: argument is not a valid code point' +slug: Web/JavaScript/Reference/Errors/Not_a_codepoint +tags: + - Errors + - JavaScript + - RangeError +translation_of: Web/JavaScript/Reference/Errors/Not_a_codepoint +--- +
{{jsSidebar("Errors")}}
+ +

メッセージ

+ +
RangeError: {0} is not a valid code point (Firefox)
+RangeError: Invalid code point {0} (Chrome)
+
+ +

エラータイプ

+ +

{{jsxref("RangeError")}}

+ +

何がうまくいかなかったのか?

+ +

{{jsxref("String.fromCodePoint()")}} メソッドは、有効なコードポイントのみを受け付けます。

+ +

コードポイントは、ユニコード文字集合の値です。これは整数 0 から 0x10FFFF までの範囲です。

+ +

{{jsxref("NaN")}} や、-1 などの負数(negative Integers)、3.14 などの非整数値(non-integers)、0x10FFFF1114111)より大きい値をこのメソッドで使うことはできません。

+ +

+ +

無効なケース

+ +
String.fromCodePoint('_');      // RangeError
+String.fromCodePoint(Infinity); // RangeError
+String.fromCodePoint(-1);       // RangeError
+String.fromCodePoint(3.14);     // RangeError
+String.fromCodePoint(3e-2);     // RangeError
+String.fromCodePoint(NaN);      // RangeError
+ +

有効なケース

+ +
String.fromCodePoint(42);       // "*"
+String.fromCodePoint(65, 90);   // "AZ"
+String.fromCodePoint(0x404);    // "\u0404"
+String.fromCodePoint(0x2F804);  // "\uD87E\uDC04"
+String.fromCodePoint(194564);   // "\uD87E\uDC04"
+String.fromCodePoint(0x1D306, 0x61, 0x1D307) // "\uD834\uDF06a\uD834\uDF07"
+
+ +

関連項目

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