aboutsummaryrefslogtreecommitdiff
path: root/files/it/web/javascript/reference/errors/unexpected_token
diff options
context:
space:
mode:
Diffstat (limited to 'files/it/web/javascript/reference/errors/unexpected_token')
-rw-r--r--files/it/web/javascript/reference/errors/unexpected_token/index.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/files/it/web/javascript/reference/errors/unexpected_token/index.html b/files/it/web/javascript/reference/errors/unexpected_token/index.html
new file mode 100644
index 0000000000..17a9c78a4c
--- /dev/null
+++ b/files/it/web/javascript/reference/errors/unexpected_token/index.html
@@ -0,0 +1,50 @@
+---
+title: 'SyntaxError: Unexpected token'
+slug: Web/JavaScript/Reference/Errors/Unexpected_token
+tags:
+ - Errori
+ - JavaScript
+ - Sintassi
+translation_of: Web/JavaScript/Reference/Errors/Unexpected_token
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="Messaggio">Messaggio</h2>
+
+<pre class="syntaxbox">SyntaxError: espressione prevista, si ottiene "x"
+SyntaxError: nome proprietà previsto, si ottiene "x"
+SyntaxError: target previsto, si ottiene "x"
+SyntaxError: nome dell'argomento rest previsto, si ottiene "x"
+SyntaxError: parentesi di chiusura prevista, si ottiene "x"
+SyntaxError: previsto '=&gt;' dopo la lista degli argomenti, si ottiene "x"
+</pre>
+
+<h2 id="Tipo_di_errore">Tipo di errore</h2>
+
+<p>{{jsxref("SyntaxError")}}</p>
+
+<h2 id="Cosa_è_andato_storto">Cosa è andato storto?</h2>
+
+<p>Era atteso un costrutto specifico del linguaggio, ma è stato fornito qualcosa di diverso. Potrebbe trattarsi di un semplice errore di digitazione.</p>
+
+<h2 id="Esempi">Esempi</h2>
+
+<h3 id="Espressione_prevista">Espressione prevista</h3>
+
+<p>Ad esempio, non è permesso terminare una lista di argomenti con la virgola, in quanto JavaScript si aspetta un altro argomento.</p>
+
+<pre class="brush: js example-bad">Math.max(2, 42,);
+// SyntaxError: expected expression, got ')'
+</pre>
+
+<p>Sarebbe invece corretto omettere la virgola o specificare un altro argomento (che potrebbe anche essere un espressione):</p>
+
+<pre class="brush: js example-good">Math.max(2, 42);
+Math.max(2, 42, 13 + 37);
+</pre>
+
+<h2 id="Vedi_anche">Vedi anche</h2>
+
+<ul>
+ <li>{{jsxref("Math.max()")}}</li>
+</ul>