aboutsummaryrefslogtreecommitdiff
path: root/files/pl/web/javascript/reference/errors/more_arguments_needed/index.html
blob: 309031c6d0df7a2015ad4481a92c61c43e2e0306 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
title: 'TypeError: More arguments needed'
slug: Web/JavaScript/Reference/Errors/More_arguments_needed
translation_of: Web/JavaScript/Reference/Errors/More_arguments_needed
---
<div>{{jsSidebar("Errors")}}</div>

<h2 id="Komunikat">Komunikat</h2>

<pre class="syntaxbox">TypeError: Object.create requires more than 0 arguments
TypeError: Object.setPrototypeOf requires more than 1 argument
TypeError: Object.defineProperties requires more than 0 arguments
</pre>

<h2 id="Typ_błędu">Typ błędu</h2>

<p>{{jsxref("TypeError")}}.</p>

<h2 id="Co_poszło_nie_tak">Co poszło nie tak?</h2>

<p>Błąd zaistniał w sposobie wywołania funkcji. Należy podać więcej argumentów.</p>

<h2 id="Przykłady">Przykłady</h2>

<p>Metoda {{jsxref("Object.create()")}} wymaga przynajmniej jednego argumentu a metoda {{jsxref("Object.setPrototypeOf()")}} wymaga przynajmniej dwóch:</p>

<pre class="brush: js example-bad">var obj = Object.create();
// TypeError: Object.create requires more than 0 arguments

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

<p>Możesz temu zaradzić ustawiając {{jsxref("null")}} jako prototyp, na przykład:</p>

<pre class="brush: js example-good">var obj = Object.create(null);

var obj = Object.setPrototypeOf({}, null);</pre>

<h2 id="Zobacz_również">Zobacz również</h2>

<ul>
 <li><a href="/en-US/docs/Web/JavaScript/Guide/Functions">Functions</a></li>
</ul>