TypeError: More arguments needed

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

Сообщение

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

Тип ошибки

Что пошло не так?

Ошибка в вызове функции. Необходимо передать больше аргументов.

Примеры

Метод Object.create() требует хотя бы один аргумент, а Object.setPrototypeOf() минимум двух:

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

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

Вы можете исправить это, установив null в качестве прототипа, например:

js
var obj = Object.create(null);

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

Смотрите также