diff options
Diffstat (limited to 'files/id/web/javascript/reference/errors/not_a_codepoint')
-rw-r--r-- | files/id/web/javascript/reference/errors/not_a_codepoint/index.html | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/files/id/web/javascript/reference/errors/not_a_codepoint/index.html b/files/id/web/javascript/reference/errors/not_a_codepoint/index.html new file mode 100644 index 0000000000..d3d8b2f934 --- /dev/null +++ b/files/id/web/javascript/reference/errors/not_a_codepoint/index.html @@ -0,0 +1,56 @@ +--- +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="Pesan">Pesan</h2> + +<pre class="syntaxbox">RangeError: Invalid code point {0} (Edge) +RangeError: {0} is not a valid code point (Firefox) +RangeError: Invalid code point {0} (Chrome) +</pre> + +<p> </p> + +<h2 id="Tipe_error">Tipe error</h2> + +<p>{{jsxref("RangeError")}}</p> + +<h2 id="Apa_yang_salah">Apa yang salah?</h2> + +<p><span class="seoSummary">{{jsxref("String.fromCodePoint()")}} throws this error when passed {{jsxref("NaN")}} values, negative Integers (-1), non-Integers (5.4), or values larger than 0x10FFFF (1114111).</span></p> + +<p>Satu <a href="https://en.wikipedia.org/wiki/Code_point">poin kode</a> ialah satu nilai dalam codespace Unicode; yaitu, kisaran integer dari <code>0</code> hingga <code>0x10FFFF</code>.</p> + +<h2 id="Contoh">Contoh</h2> + +<h3 id="Kasus_tak_nvalid">Kasus tak nvalid</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="Kasus_valid">Kasus valid</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="Lihat_juga">Lihat juga</h2> + +<ul> + <li>{{jsxref("String.fromCodePoint()")}}</li> +</ul> |