aboutsummaryrefslogtreecommitdiff
path: root/files/hu/web/javascript/reference/errors
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
commit1109132f09d75da9a28b649c7677bb6ce07c40c0 (patch)
tree0dd8b084480983cf9f9680e8aedb92782a921b13 /files/hu/web/javascript/reference/errors
parent4b1a9203c547c019fc5398082ae19a3f3d4c3efe (diff)
downloadtranslated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.gz
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.bz2
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.zip
initial commit
Diffstat (limited to 'files/hu/web/javascript/reference/errors')
-rw-r--r--files/hu/web/javascript/reference/errors/bad_return_or_yield/index.html54
-rw-r--r--files/hu/web/javascript/reference/errors/index.html31
-rw-r--r--files/hu/web/javascript/reference/errors/stmt_after_return/index.html67
-rw-r--r--files/hu/web/javascript/reference/errors/unexpected_token/index.html46
-rw-r--r--files/hu/web/javascript/reference/errors/érvénytelen_típus/index.html70
5 files changed, 268 insertions, 0 deletions
diff --git a/files/hu/web/javascript/reference/errors/bad_return_or_yield/index.html b/files/hu/web/javascript/reference/errors/bad_return_or_yield/index.html
new file mode 100644
index 0000000000..2892367f9a
--- /dev/null
+++ b/files/hu/web/javascript/reference/errors/bad_return_or_yield/index.html
@@ -0,0 +1,54 @@
+---
+title: 'Hibaleírás: SyntaxError: return not in function'
+slug: Web/JavaScript/Reference/Errors/Bad_return_or_yield
+tags:
+ - Error
+translation_of: Web/JavaScript/Reference/Errors/Bad_return_or_yield
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="Üzenet">Üzenet</h2>
+
+<pre class="syntaxbox">SyntaxError: 'return' statement outside of function (Edge)
+SyntaxError: return not in function (Firefox)
+SyntaxError: yield not in function (Firefox)
+</pre>
+
+<h2 id="Hiba_típusa">Hiba típusa</h2>
+
+<p>{{jsxref("SyntaxError")}}.</p>
+
+<h2 id="Mi_történt">Mi történt?</h2>
+
+<p>Egy  <code><a href="/en-US/docs/Web/JavaScript/Reference/Statements/return">return</a></code> vagy <code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/yield">yield</a></code> utasítás szerepel <a href="/en-US/docs/Web/JavaScript/Guide/Functions">function</a>-ön kívül. Lehet, hogy egy kapcsos zárójel hiányzik? A <code>return</code> és <code>yield</code> utasításoknak függvényen belül kell szerepelniük, mert csak itt értelmezhetőek. (Megszakítják illetve megállítják-folytatják a proramrész futását, és opcionálisan értékrt adnak vissza.)</p>
+
+<h2 id="Példák">Példák</h2>
+
+<pre class="brush: js example-bad">var cheer = function(score) {
+ if (score === 147)
+ return 'Maximum!';
+ };
+ if (score &gt; 100) {
+ return 'Century!';
+ }
+}
+
+// SyntaxError: return not in function</pre>
+
+<p>A kapcsos zárójelek első ránézésre jól vannak rendezve, de a kódrészletből hiányzik egy <code>{</code> az első <code>if</code> utasítás után. A helyes kód így nézne ki:</p>
+
+<pre class="brush: js example-good">var cheer = function(score) {
+ if (score === 147) {
+ return 'Maximum!';
+ }
+ if (score &gt; 100) {
+ return 'Century!';
+ }
+};</pre>
+
+<h2 id="Lásd_még">Lásd még</h2>
+
+<ul>
+ <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Statements/return">return</a></code></li>
+ <li><code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/yield">yield</a></code></li>
+</ul>
diff --git a/files/hu/web/javascript/reference/errors/index.html b/files/hu/web/javascript/reference/errors/index.html
new file mode 100644
index 0000000000..c295fccea6
--- /dev/null
+++ b/files/hu/web/javascript/reference/errors/index.html
@@ -0,0 +1,31 @@
+---
+title: JavaScript error reference
+slug: Web/JavaScript/Reference/Errors
+tags:
+ - Debugging
+ - Error
+ - Errors
+ - Exception
+ - JavaScript
+ - NeedsTranslation
+ - TopicStub
+ - exceptions
+translation_of: Web/JavaScript/Reference/Errors
+---
+<p>{{jsSidebar("Errors")}}</p>
+
+<p>Below, you'll find a list of errors which are thrown by JavaScript. These errors can be a helpful debugging aid, but the reported problem isn't always immediately clear. The pages below will provide additional details about these errors. Each error is an object based upon the {{jsxref("Error")}} object, and has a <code>name</code> and a <code>message</code>.</p>
+
+<p>Errors displayed in the Web console may include a link to the corresponding page below to help you quickly comprehend the problem in your code.</p>
+
+<h2 id="List_of_errors">List of errors</h2>
+
+<p>In this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). Together, these two properties provide a starting point toward understanding and resolving the error. For more information, follow the links below!</p>
+
+<p>{{ListSubPages("/en-US/docs/Web/JavaScript/Reference/Errors")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Learn/JavaScript/First_steps/What_went_wrong">What went wrong? Troubleshooting JavaScript</a>: Beginner's introductory tutorial on fixing JavaScript errors.</li>
+</ul>
diff --git a/files/hu/web/javascript/reference/errors/stmt_after_return/index.html b/files/hu/web/javascript/reference/errors/stmt_after_return/index.html
new file mode 100644
index 0000000000..038658955c
--- /dev/null
+++ b/files/hu/web/javascript/reference/errors/stmt_after_return/index.html
@@ -0,0 +1,67 @@
+---
+title: 'Hibaleírás: Warning: unreachable code after return statement'
+slug: Web/JavaScript/Reference/Errors/Stmt_after_return
+translation_of: Web/JavaScript/Reference/Errors/Stmt_after_return
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="Üzenet">Üzenet</h2>
+
+<pre class="syntaxbox">Warning: unreachable code after return statement (Firefox)
+</pre>
+
+<h2 id="Hiba_típusa">Hiba típusa</h2>
+
+<p>Figyelmeztetés</p>
+
+<h2 id="Mi_történt">Mi történt?</h2>
+
+<p>A return utasítás befejezi a függvény végrehajtását, és opcionálisan értéket ad vissza. Ha <code>return</code> szerepel a függvényben közvetlenül (tehát nem <code>if</code>-be ágyazva), akkor a return mindig végrehajtódik. Ez esetben, ha a return után van még valamilyen kód, az soha nem fog végrehajtódni. Ezt jelzi a figyelmeztetés.</p>
+
+<p>Ha a return után nincs pontosvessző, majd a következő sorban egy kifejezés (szám, string, ...) szerepel, a figyelmezetés akkor is megjelenik. A JavaScript ugyanis bizonyos esetekben az entert is pontosvesszőnek értelmezi, így a return utasítás lefut, a mögötte található kifejezés pedig nem lesz értelmezve.</p>
+
+<p>Nem jelenik meg figyelmeztetés a pontosvessző nélküli returnre, ha az alábbi utasítások valamelyike követi:</p>
+
+<ul>
+ <li>{{jsxref("Statements/throw", "throw")}}</li>
+ <li>{{jsxref("Statements/break", "break")}}</li>
+ <li>{{jsxref("Statements/var", "var")}}</li>
+ <li>{{jsxref("Statements/function", "function")}}</li>
+</ul>
+
+<h2 id="Példák">Példák</h2>
+
+<h3 id="Hibás_használatok">Hibás használatok</h3>
+
+<pre class="brush: js example-bad">function f() {
+ var x = 3;
+ x += 4;
+ return x; // a return azonnal visszatér a függvényből
+ x -= 3; // tehát ez a sor soha nem fog lefutni; nem elérhető
+}
+
+function f() {
+ return // ez 'return'-ként értelmeződik
+ 3 + 4; // tehát a funkció visszatér és ezt a sort soha nem éri el
+}
+</pre>
+
+<h3 id="Helyes_használat">Helyes használat</h3>
+
+<pre class="brush: js example-good">function f() {
+ var x = 3;
+ x += 4;
+ x -= 3;
+ return x; // OK: visszatér minden más utasítás után
+}
+
+function f() {
+ return 3 + 4 // OK: pontosvessző nélküli return, kifejezéssel ugyanazon sorban
+}
+</pre>
+
+<h2 id="Lásd_még">Lásd még</h2>
+
+<ul>
+ <li>{{jsxref("Statements/return", "Automatic Semicolon Insertion", "#Automatic_Semicolon_Insertion", 1)}}</li>
+</ul>
diff --git a/files/hu/web/javascript/reference/errors/unexpected_token/index.html b/files/hu/web/javascript/reference/errors/unexpected_token/index.html
new file mode 100644
index 0000000000..6e6640b551
--- /dev/null
+++ b/files/hu/web/javascript/reference/errors/unexpected_token/index.html
@@ -0,0 +1,46 @@
+---
+title: 'SyntaxError: Unexpected token'
+slug: Web/JavaScript/Reference/Errors/Unexpected_token
+translation_of: Web/JavaScript/Reference/Errors/Unexpected_token
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="Üzenet">Üzenet</h2>
+
+<pre class="syntaxbox">SyntaxError: expected expression, got "x"
+SyntaxError: expected property name, got "x"
+SyntaxError: expected target, got "x"
+SyntaxError: expected rest argument name, got "x"
+SyntaxError: expected closing parenthesis, got "x"
+SyntaxError: expected '=&gt;' after argument list, got "x"
+</pre>
+
+<h2 id="Hiba_Típusa">Hiba Típusa</h2>
+
+<p>{{jsxref("SyntaxError")}}</p>
+
+<h2 id="Mi_nem_jó">Mi nem jó?</h2>
+
+<p>A nyelv specifikációja várna egy bizonyos nyelvi formát, de az nem teljesül. Valószínűleg ez egy egyszerű elírás.</p>
+
+<h2 id="Példák">Példák</h2>
+
+<h3 id="Várható_kifejezések">Várható kifejezések</h3>
+
+<p>Például, ha egy függvény egy lezáró vesszővel hívünk meg, ez nem helyes. Ugyanis a JavaScript egy argumentumot vár ilyenkor, ami bármilyen bárilyen kifejezés is lehet.</p>
+
+<pre class="brush: js example-bad">Math.max(2, 42,);
+// SyntaxError: expected expression, got ')'
+</pre>
+
+<p>Correct would be omitting the comma or adding another argument:</p>
+
+<pre class="brush: js example-good">Math.max(2, 42);
+Math.max(2, 42, 13 + 37);
+</pre>
+
+<h2 id="Lásd_még">Lásd még</h2>
+
+<ul>
+ <li>{{jsxref("Math.max()")}}</li>
+</ul>
diff --git a/files/hu/web/javascript/reference/errors/érvénytelen_típus/index.html b/files/hu/web/javascript/reference/errors/érvénytelen_típus/index.html
new file mode 100644
index 0000000000..1fd4e782de
--- /dev/null
+++ b/files/hu/web/javascript/reference/errors/érvénytelen_típus/index.html
@@ -0,0 +1,70 @@
+---
+title: 'Típushiba: "x" (nem) "y"'
+slug: Web/JavaScript/Reference/Errors/Érvénytelen_típus
+translation_of: Web/JavaScript/Reference/Errors/Unexpected_type
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<div>Az „<var>x</var> (nem) <var>y</var>” JavaScript-kivétel akkor keletkezik, ha egy váratlan típus fordul elő. Ez leginkább váratlan {{jsxref("undefined")}} vagy {{jsxref("null")}} értéket jelent.</div>
+
+<h2 id="Üzenet">Üzenet</h2>
+
+<pre class="syntaxbox">TypeError: Unable to get property {x} of undefined or null reference (Edge)
+TypeError: "x" is (not) "y" (Firefox)
+
+Példák:
+TypeError: "x" is undefined
+TypeError: "x" is null
+TypeError: "undefined" is not an object
+TypeError: "x" is not an object or null
+TypeError: "x" is not a symbol
+</pre>
+
+<h2 id="Hiba_típusa">Hiba típusa</h2>
+
+<p>{{jsxref("TypeError")}}.</p>
+
+<h2 id="Mi_történt">Mi történt?</h2>
+
+<p>Váratlan típus fordult elő a végrehajtás során. Ez leginkább {{jsxref("undefined")}} vagy {{jsxref("null")}} értékek esetén történik.</p>
+
+<p>Ugyanígy bizonyos metódusok – mint például az {{jsxref("Object.create()")}} vagy a {{jsxref("Symbol.keyFor()")}} – paraméterként egy meghatározott típust várnak.</p>
+
+<h2 id="Példák">Példák</h2>
+
+<h3 id="Hibás_használatok">Hibás használatok</h3>
+
+<pre class="brush: js example-bad">// nem definiált és null értékű paraméterek használata, amiknek esetén a substring metódus nem működik
+var foo = undefined;
+foo.substring(1); // TypeError: foo nincs definiálva
+
+var foo = null;
+foo.substring(1); // TypeError: foo értéke null
+
+
+// Bizonyos metódusok meghatározott típust várnak el
+var foo = {}
+Symbol.keyFor(foo); // TypeError: foo nem szimbólum
+
+var foo = 'bar'
+Object.create(foo); // TypeError: "foo" nem objektum vagy null értékű
+</pre>
+
+<h3 id="A_hiba_javítása">A hiba javítása</h3>
+
+<p>Az <code>undefined</code> értékek kiszűrésére például a <a href="/en-US/docs/Web/JavaScript/Reference/Operators/typeof">typeof</a> operátort lehet használni.</p>
+
+<pre class="brush: js">if (foo !== undefined) {
+ // Most, hogy tudjuk foo definiálva van, léphetünk tovább.
+}
+if (typeof foo !== 'undefined') {
+ // Ugyanaz a jó ötlet, de nem használandó implementáció – problémákat tud okozni
+ // a ténylegesen definiálatlan és a deklarálatlan változók közötti kavarodás miatt.
+}</pre>
+
+<h2 id="Lásd_még">Lásd még</h2>
+
+<ul>
+ <li>{{jsxref("undefined")}}</li>
+ <li>{{jsxref("null")}}</li>
+</ul>