The JavaScript exception "missing ) after argument list" occurs when there is an error with how a function is called. This might be a typo, a missing operator, or an unescaped string.
The JavaScript exception "missing ) after argument list" occurs when there is an error with how a function is called. This might be a typo, a missing operator, or an unescaped string.
There is an error with how a function is called. This might be a typo, a missing operator, or an unescaped string, for example.
Because there is no "+" operator to concatenate the string, JavaScript expects the argument for the log
function to be just "PI: "
. In that case, it should be terminated by a closing parenthesis.
You can correct the log
call by adding the +
operator:
Alternatively, you can consider using a template literal, or take advantage of the fact that console.log
accepts multiple parameters:
console.log('"Java" + "Script" = \"' + "Java" + 'Script\"); // SyntaxError: missing ) after argument list
Here JavaScript thinks that you meant to have );
inside the string and ignores it, and it ends up not knowing that you meant the );
to end the function console.log
. To fix this, we could put a'
after the "Script" string:
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Missing_parenthesis_after_argument_list