From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- .../reference/errors/unexpected_token/index.html | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 files/it/web/javascript/reference/errors/unexpected_token/index.html (limited to 'files/it/web/javascript/reference/errors/unexpected_token') 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 +--- +
{{jsSidebar("Errors")}}
+ +

Messaggio

+ +
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 '=>' dopo la lista degli argomenti, si ottiene "x"
+
+ +

Tipo di errore

+ +

{{jsxref("SyntaxError")}}

+ +

Cosa è andato storto?

+ +

Era atteso un costrutto specifico del linguaggio, ma è stato fornito qualcosa di diverso. Potrebbe trattarsi di un semplice errore di digitazione.

+ +

Esempi

+ +

Espressione prevista

+ +

Ad esempio, non è permesso terminare una lista di argomenti con la virgola, in quanto JavaScript si aspetta un altro argomento.

+ +
Math.max(2, 42,);
+// SyntaxError: expected expression, got ')'
+
+ +

Sarebbe invece corretto omettere la virgola o specificare un altro argomento (che potrebbe anche essere un espressione):

+ +
Math.max(2, 42);
+Math.max(2, 42, 13 + 37);
+
+ +

Vedi anche

+ + -- cgit v1.2.3-54-g00ecf