Open In App

JavaScript SyntaxError – Missing } after property list

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

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 comma in the object initializer syntax.

Example 1: In this example, there is a missing comma, So the error has occurred.

Javascript




let GFG_Obj = {
    prop1: 1,
    // Missing "," here
    prop2: { prop21: 2 }
prop3: 3
};
console.log(GFG_Obj);


Output(In console):

SyntaxError: Expected '}'

Example 2: In this example, there is a missing curly bracket, So the error has occurred.

Javascript




let GFG_Obj = {
    prop1: 1,
    // Missing "}" here
    prop2: {
        prop21: 2,
        prop3: 3
    };
console.log(GFG_Obj);


Output(In console): 

SyntaxError: Expected '}'

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads