← 返回首页
TypeError: More arguments needed - JavaScript | MDN

Esta página ha sido traducida del inglés por la comunidad. Aprende más y únete a la comunidad de MDN Web Docs.

View in English Always switch to English

TypeError: More arguments needed

Mensage

TypeError: argument is not an Object and is not null (Edge) TypeError: Object.create necesita al menos 1 argumento, pero solo only 0 fueron aprovadas. TypeError: Object.setPrototypeOf necesita al menos 2 argumentos, pero solo 0 fueron aprovados TypeError: Object.defineProperties requires at least 1 argument, but only 0 were passed

In this article

Tipo de error

TypeError.

¿Qué fué mal?

Hay un error con que una funcion es llamada. Más argumentos necesitan ser dados.

Ejemplos

El método Object.create() necesita al menos un argumento y el método Object.setPrototypeOf() necesita al menos 2 argumentos.

js
var obj = Object.create(); // TypeError: Object.create necesita al menos 1 argumento, pero ninguno fue aprovad var obj = Object.setPrototypeOf({}); // TypeError: Object.setPrototypeOf requires at least 2 arguments, but only 1 were passed

Puedes arreglar esto configurando null como el prototipo, por ejemplo:

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

Ver también