Categories
JavaScript Answers

How to fix SyntaxError: missing ) after argument list with JavaScript?

Spread the love

Sometimes, we want to fix SyntaxError: missing ) after argument list with JavaScript.

In this article, we’ll look at how to fix SyntaxError: missing ) after argument list with JavaScript.

How to fix SyntaxError: missing ) after argument list with JavaScript?

To fix SyntaxError: missing ) after argument list with JavaScript, we should make sure the open and closing parentheses match.

For instance, we write

const navs = document.getElementsByClassName("nav-coll");

for (const nav of navs) {
  nav.addEventListener(
    "click",
    () => {
      console.log("clicked");
    },
    false
  );
}

to call getEleemntsByClassName, addEventListener and cnsole.log with matching opening and closing parentheses to clear the error.

Conclusion

To fix SyntaxError: missing ) after argument list with JavaScript, we should make sure the open and closing parentheses match.

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 *