Categories
JavaScript Answers

How to Fix the ‘SyntaxError: missing ) after argument list ‘ Error in Our JavaScript App?

Spread the love

Sometimes, we may run into the ‘SyntaxError: missing ) after argument list’ when we’re developing JavaScript apps.

In this article, we’ll look at how to fix the ‘SyntaxError: missing ) after argument list’ when we’re developing JavaScript apps.

Fix the ‘SyntaxError: missing ) after argument list’ When Developing JavaScript Apps

To fix the ‘SyntaxError: missing ) after argument list’ when we’re developing JavaScript apps, we should make sure we have corresponding closing parentheses for each opening parentheses in our JavaScript code.

On Edge, the error message for this error is SyntaxError: Expected ')'.

And on Firefox, the error message for this error is SyntaxError: missing ) after argument list.

For instance, if we write:

console.log('PI: ' Math.PI);

then the error will be thrown because we’re missing the comma between 'PI: ' and Math.PI.

To fix this, we write:

console.log('PI: ',  Math.PI);

The error will also be thrown if we have unterminated strings.

For instance, if we write:

console.log('"Java"' + 'Java' + 'Script\");

then we’ll get the error since we don’t have a closing single quote in the 'Script\" string.

To fix this, we write:

console.log('"Java"' + 'Java' + 'Script\"');

Conclusion

To fix the ‘SyntaxError: missing ) after argument list’ when we’re developing JavaScript apps, we should make sure we have corresponding closing parentheses for each opening parentheses in our JavaScript code.

On Edge, the error message for this error is SyntaxError: Expected ')'.

And on Firefox, the error message for this error is SyntaxError: missing ) after argument list.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *