★ wanayoo — archive 1999 https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Errors/More_arguments_neededNouvelle recherche | Portail wanayoo

MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

我們的志工尚未將本文翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
您也可以閱讀本文的 English (US) 版本。

Message

TypeError: Object.create requires more than 0 arguments
TypeError: Object.setPrototypeOf requires more than 1 argument
TypeError: Object.defineProperties requires more than 0 arguments

Error type

TypeError.

What went wrong?

There is an error with how a function is called. More arguments need to be provided.

Examples

The Object.create() method requires at least one argument and the Object.setPrototypeOf() method requires at least two arguments:

var obj = Object.create();
// TypeError: Object.create requires more than 0 arguments

var obj = Object.setPrototypeOf({});
// TypeError: Object.setPrototypeOf requires more than 1 argument

You can fix this by setting null as the prototype, for example:

var obj = Object.create(null);

var obj = Object.setPrototypeOf({}, null);

See also

文件標籤與貢獻者

 此頁面的貢獻者: fscholz
 最近更新: fscholz,