[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Errors/Missing_formal_parameter [Back]  [Original]

SyntaxError: Malformed formal parameter - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

SyntaxError: Malformed formal parameter

Message

    SyntaxError: malformed formal parameter (Firefox)

In this article

Error type

SyntaxError

?

Function() . . .

. if var . .

, . ?

. " " " " . " " .

Examples

Invalid cases

js
var f = Function("x y", "return x + y;");
// SyntaxError (missing a comma)

var f = Function("x,", "return x;");
// SyntaxError (extraneous comma)

var f = Function(37, "alert('OK')");
// SyntaxError (numbers can't be argument names)

Valid cases

js
var f = Function("x, y", "return x + y;"); // correctly punctuated

var f = Function("x", "return x;");

// if you can, avoid using Function - this is much faster
var f = function (x) {
  return x;
};

See also


Web Proxy Viewer  |  New URL  |  Original Page