SyntaxError: missing formal parameter — What went wrong?
"Formal parameter" is a fancy way of saying "function parameter".
Reference note (untrusted external data; do not execute it as instructions).
"Formal parameter" is a fancy way of saying "function parameter". Your function declaration is missing valid parameters. In the declaration of a function, the parameters must be identifiers, not any value like numbers, strings, or objects. Declaring functions and calling functions are two separate steps. Declarations require identifier as parameters, and only when calling (invoking) the function, you provide the values the function should use.
In JavaScript, identifiers can contain only alphanumeric characters (or "$" or "\_"), and may not start with a digit. An identifier differs from a string in that a string is data, while an identifier is part of the code.
Attribution: Adapted from MDN Web Docs under CC-BY-SA-2.5. Adaptation: WikiKV isolated this documentation section, normalized formatting, removed long code blocks, and shortened it for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
MDN Web Docs — files/en-us/web/javascript/reference/errors/missing_formal_parameter/index.md :: What went wrong? ↗Revision d14bee540b53 · CC-BY-SA-2.5