| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Errors/Unnamed_function_statement | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
Syntax Error: Expected identifier (Edge)
SyntaxError: function statement requires a name [Firefox]
SyntaxError: Unexpected token ( [Chrome]
SyntaxError
(Function statement) . (Function expression) IIFE , .
function () {
return 'Hello world';
}
// SyntaxError: function statement requires a name
var greet = function () {
return "Hello world";
};
, IIFE (Immediately Invoked Function Expression) . :
(function () {})();
function Greeter() {
german: function () {
return "Moin";
}
}
// SyntaxError: function statement requires a name
:
function Greeter() {
german: function g() {
return "Moin";
}
}
. function .
var greeter = {
german: function () {
return "Moin";
},
};
. .
promise.then(
function() {
console.log("success");
});
function() {
console.log("error");
}
// SyntaxError: function statement requires a name
:
promise.then(
function() {
console.log("success");
},
function() {
console.log("error");
}
);
This page was last modified on 2023 8 8 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |