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 error with function calls. This could be either be a typing mistake, a missing operator, or an unescaped string.

Example 1: In this example, there is a missing operator in string concatenation, So the error has occurred.



HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<head>
    <title>Syntax Error</title>
</head>
<body>
    <script>
        var str1 = 'This is ';
        var str2 = 'GeeksforGeeks';
        document.write(str1 str2);
    </script>
</body>
</html>

chevron_right


Output(In console):

SyntaxError: missing ) after argument list

Example 2: In this example, there is a unescaped string, So the error has occurred.

HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<head>
    <title>Syntax Error</title>
</head>
<body>
    <script>
        var str1 = 'This is ';
        var str2 = 'GeeksforGeeks';
        document.write(str1 \str2);
    </script>
</body>
</html>

chevron_right


Output(in console):

SyntaxError: missing ) after argument list

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.