aboutsummaryrefslogtreecommitdiff
path: root/files/nl/web/javascript/reference/errors
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/nl/web/javascript/reference/errors
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/nl/web/javascript/reference/errors')
-rw-r--r--files/nl/web/javascript/reference/errors/index.html31
-rw-r--r--files/nl/web/javascript/reference/errors/not_defined/index.html70
-rw-r--r--files/nl/web/javascript/reference/errors/unexpected_token/index.html48
3 files changed, 149 insertions, 0 deletions
diff --git a/files/nl/web/javascript/reference/errors/index.html b/files/nl/web/javascript/reference/errors/index.html
new file mode 100644
index 0000000000..c295fccea6
--- /dev/null
+++ b/files/nl/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/nl/web/javascript/reference/errors/not_defined/index.html b/files/nl/web/javascript/reference/errors/not_defined/index.html
new file mode 100644
index 0000000000..9fb12d7937
--- /dev/null
+++ b/files/nl/web/javascript/reference/errors/not_defined/index.html
@@ -0,0 +1,70 @@
+---
+title: 'ReferenceError: "x" is not defined'
+slug: Web/JavaScript/Reference/Errors/Not_defined
+tags:
+ - Foutmelding
+ - JavaScript
+ - ReferenceError
+translation_of: Web/JavaScript/Reference/Errors/Not_defined
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="Foutmelding">Foutmelding</h2>
+
+<pre class="syntaxbox">ReferenceError: "x" is not defined
+</pre>
+
+<h2 id="Type_fout">Type fout</h2>
+
+<p>{{jsxref("ReferenceError")}}.</p>
+
+<h2 id="Wat_is_er_fout_gegaan">Wat is er fout gegaan?</h2>
+
+<p>Er is ergens een niet bestaande variabele genoemd. Deze variabele moet je declareren, of je moet er voor zorgen dat deze beschikbaar is in het script of {{Glossary("scope")}}.</p>
+
+<div class="note">
+<p><strong>Notitie:</strong> Wanneer je een library (zoals jQuery) laadt, zorg er dan voor dat die geladen is voordat je de library's variabelen wilt gebruiken, zoals "$". Zet de {{HTMLElement("script")}} tag die de library laadt, voor de code die de variabele gebruikt.</p>
+</div>
+
+<h2 id="Voorbeelden">Voorbeelden</h2>
+
+<h3 id="Variabele_niet_gedefineerd">Variabele niet gedefineerd</h3>
+
+<pre class="brush: js example-bad">foo.substring(1); // ReferenceError: foo is not defined
+</pre>
+
+<p>De "foo" variable is nergens gedefineerd. De variabele moet een string zijn, zodat de {{jsxref("String.prototype.substring()")}} method kan werken.</p>
+
+<pre class="brush: js example-good">var foo = "bar";
+foo.substring(1); // "ar"</pre>
+
+<h3 id="Verkeerde_scope">Verkeerde scope</h3>
+
+<p>Een variabele moet beschikbaar zijn in de huidige context of execution. Variabelen gedefineerd binnen een <a href="/en-US/docs/Web/JavaScript/Reference/Functions">functie</a> kunnen niet van ergens anders buiten de functie worden benarderd, omdat de variabele alleenmaar in de scope van de functie gedefineerd is</p>
+
+<pre class="brush: js example-bad">function numbers () {
+ var num1 = 2,
+ num2 = 3;
+ return num1 + num2;
+}
+
+console.log(num1); // ReferenceError num1 is not defined.</pre>
+
+<p>Maar, een functie kan alle andere variabelen benaderen in de scope waarin hij gedefineerd is. Oftewel, een functie die in de global scope is gedefineerd, kan alle variabelen benaderen in de global scope.</p>
+
+<pre class="brush: js example-good">var num1 = 2,
+ num2 = 3;
+
+function numbers () {
+ return num1 + num2;
+}
+
+console.log(num1); // 2</pre>
+
+<h2 id="Zie_ook">Zie ook</h2>
+
+<ul>
+ <li>{{Glossary("Scope")}}</li>
+ <li><a href="/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Declaring_variables">Declareren van  variabelen in de JavaScript Guide</a></li>
+ <li><a href="/en-US/docs/Web/JavaScript/Guide/Functions#Function_scope/en-US/docs/">Function scope in de JavaScript Guide</a></li>
+</ul>
diff --git a/files/nl/web/javascript/reference/errors/unexpected_token/index.html b/files/nl/web/javascript/reference/errors/unexpected_token/index.html
new file mode 100644
index 0000000000..264e8f5858
--- /dev/null
+++ b/files/nl/web/javascript/reference/errors/unexpected_token/index.html
@@ -0,0 +1,48 @@
+---
+title: 'SyntaxError: Onverwacht teken'
+slug: Web/JavaScript/Reference/Errors/Unexpected_token
+translation_of: Web/JavaScript/Reference/Errors/Unexpected_token
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="Boodschap">Boodschap</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="type_Error">type Error</h2>
+
+<p>{{jsxref("SyntaxError")}}</p>
+
+<h2 id="Wat_ging_er_mis">Wat ging er mis?</h2>
+
+<p>A specifieke taalconstructie werd verwacht, maar er werd iets anders geboden. Dit kan een simpele typfout zijn.</p>
+
+<p>Er wordt een specifieke opbouw van de expressie verwacht, maar een andere werd "aangeboden". Het kan zijn dat een simpele typefout hiervan de oorzaak is.</p>
+
+<h2 id="Voorbeelden">Voorbeelden</h2>
+
+<h3 id="Expression_verwacht">Expression verwacht</h3>
+
+<p>Bijvoorbeeld, bij het uitvoeren van een functie zijn geen comma's toegelaten op het einde van de regel. JavaScript verwacht dan nog een argument dat in feite eender welke  expression kan zijn.</p>
+
+<pre class="brush: js example-bad">Math.max(2, 42,);
+// SyntaxError: expected expression, got ')'
+</pre>
+
+<p>De juiste methode is om de comma te verwijderen of een bijkomend argument toe te voegen:</p>
+
+<pre class="brush: js example-good">Math.max(2, 42);
+Math.max(2, 42, 13+37);
+</pre>
+
+<h2 id="Zie_ook">Zie ook</h2>
+
+<ul>
+ <li>{{jsxref("Math.max()")}}</li>
+</ul>