diff options
author | Ryan Johnson <rjohnson@mozilla.com> | 2021-04-29 16:16:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-29 16:16:42 -0700 |
commit | 95aca4b4d8fa62815d4bd412fff1a364f842814a (patch) | |
tree | 5e57661720fe9058d5c7db637e764800b50f9060 /files/it/web/javascript/reference/errors/invalid_array_length | |
parent | ee3b1c87e3c8e72ca130943eed260ad642246581 (diff) | |
download | translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.gz translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.bz2 translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.zip |
remove retired locales (#699)
Diffstat (limited to 'files/it/web/javascript/reference/errors/invalid_array_length')
-rw-r--r-- | files/it/web/javascript/reference/errors/invalid_array_length/index.html | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/files/it/web/javascript/reference/errors/invalid_array_length/index.html b/files/it/web/javascript/reference/errors/invalid_array_length/index.html deleted file mode 100644 index 61ee1cba5f..0000000000 --- a/files/it/web/javascript/reference/errors/invalid_array_length/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: 'RangeError: invalid array length' -slug: Web/JavaScript/Reference/Errors/Invalid_array_length -tags: - - Errori - - JavaScript - - RangeError -translation_of: Web/JavaScript/Reference/Errors/Invalid_array_length ---- -<div>{{jsSidebar("Errors")}}</div> - -<h2 id="Messaggio">Messaggio</h2> - -<pre class="syntaxbox">RangeError: invalid array length (Firefox) -RangeError: Invalid array length (Chrome) -RangeError: Invalid array buffer length (Chrome) -</pre> - -<h2 id="Tipo_di_errore">Tipo di errore</h2> - -<p>{{jsxref("RangeError")}}</p> - -<h2 id="Cosa_è_andato_storto">Cosa è andato storto?</h2> - -<p>Un invalid array length può comparire in queste situazioni:</p> - -<ul> - <li>Quando viene creato un {{jsxref("Array")}} o un {{jsxref("ArrayBuffer")}} che ha lunghezza negativa o maggiore uguale a 2<sup>32</sup>, oppure</li> - <li>quando viene impostata la proprietà {{jsxref("Array.length")}} a un valore che è negativo o maggiore uguale a 2<sup>32</sup>.</li> -</ul> - -<p>Perché la lunghezza di <code>Array</code> e <code>ArrayBuffer</code> è limitata? La proprietà <code>length</code> di un <code>Array </code>o di un <code>ArrayBuffer</code> è rappresentata da un intero di 32-bit senza segno, che quindi permette di memorizzare valori nell'intervallo da 0 a 2<sup>32 </sup>- 1.</p> - -<p>Se stai creando un <code>Array</code> utilizzando il costruttore, potresti invece utilizzare la notazione letterale dove il primo argomento è interpretato come la lunghezza dell' <code>Array</code>.</p> - -<p>Altrimenti, potresti voler bloccare la lunghezza prima di settare la proprietà length, o utilizzarla come argomento del costruttore.</p> - -<h2 id="Esempi">Esempi</h2> - -<h3 id="Casi_non_validi">Casi non validi</h3> - -<pre class="brush: js example-bad">new Array(Math.pow(2, 40)) -new Array(-1) -new ArrayBuffer(Math.pow(2, 32)) -new ArrayBuffer(-1) - -let a = []; -a.length = a.length - 1; // setta -1 alla proprietà length - -let b = new Array(Math.pow(2, 32) - 1); -b.length = b.length + 1; // setta 2^32 alla proprietà length -</pre> - -<h3 id="Casi_validi">Casi validi</h3> - -<pre class="brush: js example-good">[ Math.pow(2, 40) ] // [ 1099511627776 ] -[ -1 ] // [ -1 ] -new ArrayBuffer(Math.pow(2, 32) - 1) -new ArrayBuffer(0) - -let a = []; -a.length = Math.max(0, a.length - 1); - -let b = new Array(Math.pow(2, 32) - 1); -b.length = Math.min(0xffffffff, b.length + 1); - -// 0xffffffff è la notazione esadecimale di 2^32 - 1 -// che può essere riscritta come (-1 >>> 0) -</pre> - -<h2 id="Guarda_anche">Guarda anche</h2> - -<ul> - <li>{{jsxref("Array")}}</li> - <li>{{jsxref("Array.length")}}</li> - <li>{{jsxref("ArrayBuffer")}}</li> -</ul> |