Open In App

JavaScript SyntaxError – Identifier starts immediately after numeric literal

Last Updated : 22 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

This JavaScript exception identifier starts immediately after a numeric literal occurs if an identifier starts with a number.

Message:

SyntaxError: Unexpected identifier after numeric literal 
             (Edge)
SyntaxError: identifier starts immediately after numeric 
             literal (Firefox)
SyntaxError: Unexpected number (Chrome)

Error Type:

SyntaxError

Cause of Error: Any JavaScript identifier should start with a letter, underscore (_), or a dollar sign ($). If they start with a digit(0-9), it will cause an error.

Example 1: In this example, there is a valid identifier, So the error has not occurred.

Javascript




// valid identifier
let GFG = 'This is GeeksforGeeks';
console.log(GFG)


Output:

This is GeeksforGeeks

Example 2: In this example, there is an identifier starting with a digit(1), So the error has occurred.

Javascript




// Invalid identifier
let 1GFG = 'This is GeeksForGeeks';
console.log(1GFG)


Output(in console): 

SyntaxError: Invalid or unexpected token

Previous Article
Next Article

Similar Reads

JavaScript SyntaxError "variable" is a reserved identifier
This JavaScript exception variable is a reserved identifier occurs if the reserved keywords are used as identifiers. Message: SyntaxError: The use of a future reserved word for an identifier is invalid (Edge) SyntaxError: "x" is a reserved identifier (Firefox) SyntaxError: Unexpected reserved word (Chrome) Error Type: SyntaxError What happened? Whe
1 min read
JavaScript SyntaxError: Unterminated string literal
This JavaScript error unterminated string literal occurs if there is a string that is not terminated properly. String literals must be enclosed by single (') or double (") quotes. Message: SyntaxError: Unterminated string constant (Edge) SyntaxError: unterminated string literal (Firefox) Error Type: SyntaxError What happened? There is a string in t
1 min read
JavaScript SyntaxError - Missing ) after argument list
This JavaScript exception missing ) after argument list occurs if there is an error in function calls. This could be a typing mistake, a missing operator, or an unescaped string. Message: SyntaxError: Expected ')' (Edge) SyntaxError: missing ) after argument list (Firefox) Error Type: SyntaxError Cause of Error: Somewhere in the code, there is an e
1 min read
JavaScript SyntaxError - Missing ) after condition
This JavaScript exception missing ) after condition occurs if there is something wrong with if condition. Parenthesis should be after the if keyword. Message: SyntaxError: Expected ')' (Edge) SyntaxError: missing ) after condition (Firefox) Error Type: SyntaxError Cause of Error: Somewhere in the code there is something wrong with if condition how
1 min read
JavaScript SyntaxError - Missing ':' after property id
This JavaScript exception missing : after property id occurs if objects are declared using the object's initialization syntax. Message: SyntaxError: Expected ':' (Edge) SyntaxError: missing : after property id (Firefox) Error Type: SyntaxError Cause of Error: Somewhere in the code, Objects are created with object initializer syntax, and colon (:) i
1 min read
JavaScript SyntaxError - Missing ] after element list
This JavaScript exception missing ] after element list occurs, It might be an error in array initialization syntax in code. Missing closing bracket (“]”) or a comma (“,”) also raises an error. Message: SyntaxError: missing ] after element list Error Type: SyntaxError Cause of Error: Somewhere in the script, there is an error with the array initiali
1 min read
JavaScript SyntaxError - Missing name after . operator
This JavaScript exception missing name after . operator occurs if the dot operator (.) is used in the wrong manner for property access. Message: SyntaxError: missing name after . operator Error Type: SyntaxError Cause of Error: The dot operator (.) is used to access the property. Users will have to provide the name of the properties to access. Some
1 min read
JavaScript SyntaxError - Missing } after function body
This JavaScript exception missing } after function body occurs if there is any syntactic mistyping while creating a function somewhere in the code. Closing curly brackets/parentheses must be incorrect order. Message: SyntaxError: Expected '}' (Edge) SyntaxError: missing } after function body (Firefox) Error Type: SyntaxError Cause of Error: Somewhe
1 min read
JavaScript SyntaxError - Missing } after property list
This JavaScript exception missing } after property list occurs if there is a missing comma, or curly bracket in the object initializer syntax. Message: SyntaxError: Expected '}' (Edge) SyntaxError: missing } after property list (Firefox) Error Type: SyntaxError Cause of Error: Somewhere in the script, there is a missing curly bracket or missing com
1 min read
How to trigger setInterval loop immediately using JavaScript ?
This article will show some simple ways in which the setInterval() method can be made to execute the function without delay. There are many procedures to do so, below all the procedures are described with the example. Note: In this article setInterval() method will start immediately for the 1st time run. Below examples illustrate the above approach
2 min read