Search e01
One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.
6 results across 6 corpora for SyntaxError: Unexpected token.
Developer library 6
What went wrong? Troubleshooting JavaScript
js } else if (guessCount = 10) { ``` The test would always return `true`, causing the program to `setGameOver()` after the first wrong guess. Be careful! ### SyntaxError: missing ) after argument list This one is pretty simple — it generally means that you've missed the closing parenthesis at the end of a function/method call. > [!NOTE] > See our [SyntaxError: missing ) after argument list](/docs/Web/JavaScript/R
Lexical grammar
0101010101n // 955733 ``` Decimal BigInt literals cannot have leading zeros to avoid confusion with legacy octal literals. ```js-nolint example-bad 0755n; // SyntaxError: invalid BigInt syntax ``` For octal `BigInt` numbers, always use zero followed by the letter "o" (uppercase or lowercase): ```js example-good 0o755n; ``` For more information about `BigInt`, see also [JavaScript data structures](/docs/Web/JavaS
Expression statement
/Reference/Operators/Object_initializer) Therefore, all of the following are invalid: ```js-nolint example-bad function foo() { console.log("foo"); }(); // SyntaxError: Unexpected token '(' // For some reason, you have a variable called `let` var let = [1, 2, 3]; let[0] = 4; // SyntaxError: Invalid destructuring assignment target { foo: 1, bar: 2, // SyntaxError: Unexpected token ':' }; ``` More dangerousl
JSON.parse()
s an object or array. ### Return value The Object, Array, string, number, boolean, or `null` value corresponding to the given JSON `text`. ### Exceptions - SyntaxError - : Thrown if the string to parse is not valid JSON. ## Description `JSON.parse()` parses a JSON string according to the [JSON grammar](/docs/Web/JavaScript/Reference/Global_Objects/JSON#full_json_grammar), then evaluates the string as if it's
void operator
unnamed, parsing it as a declaration will immediately generate a syntax error. ```js-nolint example-bad function iife() { console.log("Executed!"); }(); // SyntaxError: Unexpected token ')' function () { console.log("Executed!"); }(); // SyntaxError: Function statements require a function name ``` In order for the function to be parsed as an [expression](/docs/Web/JavaScript/Reference/Operators/function), the
Functions
which is a common mistake when implementing [IIFEs](/docs/Glossary/IIFE) (Immediately Invoked Function Expressions). ```js-nolint example-bad function () { // SyntaxError: Function statements require a function name console.log("FOO!"); }(); function foo() { console.log("FOO!"); }(); // SyntaxError: Unexpected token ')' ``` Instead, start the expression statement with something else, so that the `function` key