Skip to content
Related Articles

Related Articles

Improve Article
JavaScript SyntaxError – Missing } after property list
  • Last Updated : 23 Jul, 2020

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>

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>

Output(In console): 

SyntaxError: Expected '}'



My Personal Notes arrow_drop_up
Recommended Articles
Page :