JavaScript SyntaxError – Missing } after property list
This JavaScript exception missing } after property list occurs if there is a missing comma, 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.
HTML
<!DOCTYPE html> < html > < head > < title >Syntax Error</ title > </ head > < body > < script > var GFG_Obj = { prop1: 1, // Missing "," here prop2: { prop21: 2 } prop3: 3 }; document.write(GFG_Obj); </ script > </ body > </ html > |
chevron_right
filter_none
Output(In console):
SyntaxError: Expected '}'
Example 2: In this example, there is a missing curly bracket, So the error has occurred.
HTML
<!DOCTYPE html> < html > < head > < title >Syntax Error</ title > </ head > < body > < script > var GFG_Obj = { prop1: 1, // Missing "}" here prop2: { prop21: 2 , prop3: 3 }; document.write(GFG_Obj); </ script > </ body > </ html > |
chevron_right
filter_none
Output(In console):
SyntaxError: Expected '}'