diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/javascript/reference/errors/not_a_codepoint | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/ja/web/javascript/reference/errors/not_a_codepoint')
-rw-r--r-- | files/ja/web/javascript/reference/errors/not_a_codepoint/index.html | 55 |
1 files changed, 55 insertions, 0 deletions
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 +--- +<div>{{jsSidebar("Errors")}}</div> + +<h2 id="メッセージ">メッセージ</h2> + +<pre class="syntaxbox">RangeError: {0} is not a valid code point (Firefox) +RangeError: Invalid code point {0} (Chrome) +</pre> + +<h2 id="エラータイプ">エラータイプ</h2> + +<p>{{jsxref("RangeError")}}</p> + +<h2 id="何がうまくいかなかったのか?">何がうまくいかなかったのか?</h2> + +<p>{{jsxref("String.fromCodePoint()")}} メソッドは、有効なコードポイントのみを受け付けます。</p> + +<p><a href="https://ja.wikipedia.org/wiki/%E7%AC%A6%E5%8F%B7%E7%82%B9">コードポイント</a>は、ユニコード文字集合の値です。これは整数 <code>0</code> から <code>0x10FFFF</code> までの範囲です。</p> + +<p>{{jsxref("NaN")}} や、-1 などの負数(negative Integers)、3.14 などの非整数値(non-integers)、<code>0x10FFFF</code>(<code>1114111</code>)より大きい値をこのメソッドで使うことはできません。</p> + +<h2 id="例">例</h2> + +<h3 id="無効なケース">無効なケース</h3> + +<pre class="brush: js example-bad">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</pre> + +<h3 id="有効なケース">有効なケース</h3> + +<pre class="brush: js example-good">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" +</pre> + +<h2 id="関連項目">関連項目</h2> + +<ul> + <li>{{jsxref("String.fromCodePoint()")}}</li> +</ul> |