diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
| commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
| tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/javascript/reference/errors/not_a_codepoint | |
| parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
| download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip | |
initial commit
Diffstat (limited to 'files/pt-br/web/javascript/reference/errors/not_a_codepoint')
| -rw-r--r-- | files/pt-br/web/javascript/reference/errors/not_a_codepoint/index.html | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/files/pt-br/web/javascript/reference/errors/not_a_codepoint/index.html b/files/pt-br/web/javascript/reference/errors/not_a_codepoint/index.html new file mode 100644 index 0000000000..7e0c85bf8d --- /dev/null +++ b/files/pt-br/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: + - Erros + - JavaScript + - RangeError +translation_of: Web/JavaScript/Reference/Errors/Not_a_codepoint +--- +<div>{{jsSidebar("Errors")}}</div> + +<h2 id="Mensagem">Mensagem</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> + + + +<h2 id="Tipo_de_Erro">Tipo de Erro</h2> + +<p>{{jsxref("RangeError")}}</p> + +<h2 id="O_que_está_errado">O que está errado?</h2> + +<p><span class="seoSummary">{{jsxref("String.fromCodePoint()")}} dispara esse erro quando são passados valores {{jsxref("NaN")}}, inteiros negativos (-1), não inteiros (5.4), ou valores maiores que 0x10FFFF (1114111).</span></p> + +<p>Um <a href="https://pt.wikipedia.org/wiki/Ponto_de_c%C3%B3digo">code point</a> é um valor Unicode; isto é,é um valor inteiro entre <code>0</code> e <code>0x10FFFF</code>.</p> + +<h2 id="Exemplos">Exemplos</h2> + +<h3 id="Errado">Errado</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="Certo">Certo</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="Veja_também">Veja também</h2> + +<ul> + <li>{{jsxref("String.fromCodePoint()")}}</li> +</ul> |
