diff options
| author | Ryan Johnson <rjohnson@mozilla.com> | 2021-04-29 16:16:42 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-29 16:16:42 -0700 |
| commit | 95aca4b4d8fa62815d4bd412fff1a364f842814a (patch) | |
| tree | 5e57661720fe9058d5c7db637e764800b50f9060 /files/nl/web/javascript/reference/statements | |
| parent | ee3b1c87e3c8e72ca130943eed260ad642246581 (diff) | |
| download | translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.gz translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.bz2 translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.zip | |
remove retired locales (#699)
Diffstat (limited to 'files/nl/web/javascript/reference/statements')
| -rw-r--r-- | files/nl/web/javascript/reference/statements/export/index.html | 155 | ||||
| -rw-r--r-- | files/nl/web/javascript/reference/statements/index.html | 149 |
2 files changed, 0 insertions, 304 deletions
diff --git a/files/nl/web/javascript/reference/statements/export/index.html b/files/nl/web/javascript/reference/statements/export/index.html deleted file mode 100644 index b08808c693..0000000000 --- a/files/nl/web/javascript/reference/statements/export/index.html +++ /dev/null @@ -1,155 +0,0 @@ ---- -title: export -slug: Web/JavaScript/Reference/Statements/export -translation_of: Web/JavaScript/Reference/Statements/export ---- -<div>{{jsSidebar("Statements")}}</div> - -<p>Het <strong><code>export</code></strong> statement wordt gebruikt bij het maken van JavaScript modules om functies, objecten of primitieve waarden te exporteren van de module zodat deze gebruikt kunnen worden door andere programmas met het {{jsxref("Statements/import", "import")}} statement.</p> - -<p>Geëxporteerde modules worden altijd uitgevoerd in {{jsxref("Strict_mode","strict mode")}}, ongeacht of dat is aangegeven. Het export-statement kan niet gebruikt worden in<em> </em>ingevoegde scripts.</p> - -<div class="note"> -<p>Deze functie is momenteel niet geïmplementeerd in Internet Explorer, Android webview en Samsung Internet. Het is wel geïmplementeerd in 'transpilers' zoals de <a href="https://github.com/google/traceur-compiler">Traceur Compiler</a>, <a href="http://babeljs.io/">Babel</a> of <a href="https://github.com/rollup/rollup">Rollup</a>.</p> -</div> - -<h2 id="Syntax">Syntax</h2> - -<pre class="brush: js line-numbers language-js">export { <var>name1</var>, <var>name2</var>, …, <var>nameN</var> }; -export { <var>variable1</var> as <var>name1</var>, <var>variable2</var> as <var>name2</var>, …, <var>nameN</var> }; -export let <var>name1</var>, <var>name2</var>, …, <var>nameN</var>; // also var, function -export let <var>name1</var> = …, <var>name2</var> = …, …, <var>nameN</var>; // also var, const -<code class="language-js">export function FunctionName() {...} -export class ClassName {...}</code> - -export default <em>expression</em>; -export default function (…) { … } // also class, function* -export default function name1(…) { … } // also class, function* -export { <var>name1</var> as default, … }; - -export * from …; -export { <var>name1</var>, <var>name2</var>, …, <var>nameN</var> } from …; -export { <var>import1</var> as <var>name1</var>, <var>import2</var> as <var>name2</var>, …, <var>nameN</var> } from …; -<code class="language-js">export { default } from …;</code></pre> - -<p> </p> - -<dl> - <dt><code>nameN</code></dt> - <dd>Identificator die geëxporteerd moet worden (zodat het geïmporteerd kan worden via {{jsxref("Statements/import", "import")}} in een ander script).</dd> -</dl> - -<h2 id="Beschrijving">Beschrijving</h2> - -<p>Er zijn 2 verschillende types van export: <strong>named </strong>en <strong>default</strong>. Er kunnen meerdere <em>named exports</em> per module bestaan, maar slechts een <em>default export</em>. Elk type komt overeen met een van de bovenstaande syntaxen.</p> - -<ul> - <li>Genoemde exports (named exports): - <pre class="brush: js">// exporteert een eerder gedeclareerde functie -export { myFunction }; - -// exporteert een constante -export const foo = Math.sqrt(2);</pre> - </li> - <li>Standaard exports (default exports) (function): - <pre class="brush: js">export default function() {} </pre> - </li> - <li>Standaard exports (default exports) (class): - <pre class="brush: js">export default class {} </pre> - </li> -</ul> - -<p>Genoemde exports zijn handig om verschillende waardes te exporteren. Tijdens de import is het verplicht om dezelfde naam als het overeenkomende object te gebruiken.</p> - -<p>Maar een standaard export kan geïmporteerd worden met enige andere naam, bijvoorbeeld:</p> - -<pre class="syntaxbox">let k; export default k = 12; // in bestand test.js - -import m from './test' // let op dat we de vrijheid hebben om import m te gebruiken in plaats van import k, omdat k een default export is. - -console.log(m); // Zal '12' in de console laten zien -</pre> - -<p>Er kan slechts 1 standaard export zijn.</p> - -<p>De volgende syntax exporteert geen standaard export van de geïmporteerde module:</p> - -<pre>export * from …;</pre> - -<p>Gebruik de volgende syntax als de standaard export nodig is:</p> - -<pre class="brush: js line-numbers language-js"><code class="language-js">export {default} from 'mod';</code></pre> - -<h2 id="Voorbeelden">Voorbeelden</h2> - -<h3 id="Genoemde_(named)_exports_gebruiken">Genoemde (named) exports gebruiken</h3> - -<p>In de module zouden we de volgende code kunnen gebruiken:</p> - -<pre class="brush: js">// module "my-module.js" -function cube(x) { - return x * x * x; -} -const foo = Math.PI + Math.SQRT2; -export { cube, foo }; -</pre> - -<p>Op deze manier zouden we in een ander script deze code kunnen hebben:</p> - -<pre class="brush: js">import { cube, foo } from 'my-module'; -console.log(cube(3)); // 27 -console.log(foo); // 4.555806215962888</pre> - -<h3 id="De_standaard_(default)_export_gebruiken">De standaard (default) export gebruiken</h3> - -<p>Als we een enkele waarde willen exporteren of willen terugvallen op een waarde voor onze module zouden we een standaard (default) export kunnen gebruiken:</p> - -<pre class="brush: js">// module "my-module.js" -export default function cube(x) { - return x * x * x; -} -</pre> - -<p>Op die manier zal het vanzelfsprekend zijn om in een ander script de standaard (default) export te importeren:</p> - -<pre class="brush: js">import cube from 'my-module'; -console.log(cube(3)); // 27 -</pre> - -<p>Merk op dat het niet mogelijk is om <code>var</code>, <code>let</code> of <code>const</code> te gebruiken met <code>export default</code>.</p> - -<h2 id="Specificaties">Specificaties</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES2015', '#sec-exports', 'Exports')}}</td> - <td>{{Spec2('ES2015')}}</td> - <td>Initiële definitie.</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-exports', 'Exports')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibiliteit">Browser compatibiliteit</h2> - -<div class="hidden">De compatibiliteitstabel op deze pagina is gegenereerd van gestructureerde data. Indien u wenst bij te dragen aan deze data, bekijk dan <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> en stuur ons een pull request.</div> - -<p>{{Compat("javascript.statements.export")}}</p> - -<h2 id="Bekijk_ook">Bekijk ook</h2> - -<ul> - <li>{{jsxref("Statements/import", "import")}}</li> - <li><a href="https://hacks.mozilla.org/2015/08/es6-in-depth-modules/">ES6 in Depth: Modules</a>, Hacks blog post by Jason Orendorff</li> - <li><a href="http://exploringjs.com/es6/ch_modules.html">Axel Rauschmayer's book: "Exploring JS: Modules"</a></li> -</ul> diff --git a/files/nl/web/javascript/reference/statements/index.html b/files/nl/web/javascript/reference/statements/index.html deleted file mode 100644 index af37d7c195..0000000000 --- a/files/nl/web/javascript/reference/statements/index.html +++ /dev/null @@ -1,149 +0,0 @@ ---- -title: Statements and declarations -slug: Web/JavaScript/Reference/Statements -tags: - - JavaScript - - NeedsTranslation - - Reference - - TopicStub - - statements -translation_of: Web/JavaScript/Reference/Statements ---- -<div>{{jsSidebar("Statements")}}</div> - -<p>JavaScript applications consist of statements with an appropriate syntax. A single statement may span multiple lines. Multiple statements may occur on a single line if each statement is separated by a semicolon. This isn't a keyword, but a group of keywords.</p> - -<h2 id="Statements_and_declarations_by_category">Statements and declarations by category</h2> - -<p>For an alphabetical listing see the sidebar on the left.</p> - -<h3 id="Control_flow">Control flow</h3> - -<dl> - <dt>{{jsxref("Statements/block", "Block")}}</dt> - <dd>A block statement is used to group zero or more statements. The block is delimited by a pair of curly brackets.</dd> - <dt>{{jsxref("Statements/break", "break")}}</dt> - <dd>Terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement.</dd> - <dt>{{jsxref("Statements/continue", "continue")}}</dt> - <dd>Terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration.</dd> - <dt>{{jsxref("Statements/Empty", "Empty")}}</dt> - <dd>An empty statement is used to provide no statement, although the JavaScript syntax would expect one.</dd> - <dt>{{jsxref("Statements/if...else", "if...else")}}</dt> - <dd>Executes a statement if a specified condition is true. If the condition is false, another statement can be executed.</dd> - <dt>{{jsxref("Statements/switch", "switch")}}</dt> - <dd>Evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case.</dd> - <dt>{{jsxref("Statements/throw", "throw")}}</dt> - <dd>Throws a user-defined exception.</dd> - <dt>{{jsxref("Statements/try...catch", "try...catch")}}</dt> - <dd>Marks a block of statements to try, and specifies a response, should an exception be thrown.</dd> -</dl> - -<h3 id="Declarations">Declarations</h3> - -<dl> - <dt>{{jsxref("Statements/var", "var")}}</dt> - <dd>Declares a variable, optionally initializing it to a value.</dd> - <dt>{{jsxref("Statements/let", "let")}}</dt> - <dd>Declares a block scope local variable, optionally initializing it to a value.</dd> - <dt>{{jsxref("Statements/const", "const")}}</dt> - <dd>Declares a read-only named constant.</dd> -</dl> - -<h3 id="Functions_and_classes">Functions and classes</h3> - -<dl> - <dt>{{jsxref("Statements/function", "function")}}</dt> - <dd>Declares a function with the specified parameters.</dd> - <dt>{{jsxref("Statements/function*", "function*")}}</dt> - <dd>Generators functions enable writing <a href="/en-US/docs/Web/JavaScript/Guide/The_Iterator_protocol">iterators</a> more easily.</dd> - <dt>{{jsxref("Statements/async_function", "async function")}}</dt> - <dd>Declares an async function with the specified parameters.</dd> - <dt>{{jsxref("Statements/return", "return")}}</dt> - <dd>Specifies the value to be returned by a function.</dd> - <dt>{{jsxref("Statements/class", "class")}}</dt> - <dd>Declares a class.</dd> -</dl> - -<h3 id="Iterations">Iterations</h3> - -<dl> - <dt>{{jsxref("Statements/do...while", "do...while")}}</dt> - <dd>Creates a loop that executes a specified statement until the test condition evaluates to false. The condition is evaluated after executing the statement, resulting in the specified statement executing at least once.</dd> - <dt>{{jsxref("Statements/for", "for")}}</dt> - <dd>Creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.</dd> - <dt>{{deprecated_inline}} {{non-standard_inline()}} {{jsxref("Statements/for_each...in", "for each...in")}}</dt> - <dd>Iterates a specified variable over all values of object's properties. For each distinct property, a specified statement is executed.</dd> - <dt>{{jsxref("Statements/for...in", "for...in")}}</dt> - <dd>Iterates over the enumerable properties of an object, in arbitrary order. For each distinct property, statements can be executed.</dd> - <dt>{{jsxref("Statements/for...of", "for...of")}}</dt> - <dd>Iterates over iterable objects (including {{jsxref("Global_Objects/Array","arrays","","true")}}, array-like objects, <a href="/en-US/docs/JavaScript/Guide/Iterators_and_Generators">iterators and generators</a>), invoking a custom iteration hook with statements to be executed for the value of each distinct property.</dd> - <dt>{{jsxref("Statements/while", "while")}}</dt> - <dd>Creates a loop that executes a specified statement as long as the test condition evaluates to true. The condition is evaluated before executing the statement.</dd> -</dl> - -<h3 id="Others">Others</h3> - -<dl> - <dt>{{jsxref("Statements/debugger", "debugger")}}</dt> - <dd>Invokes any available debugging functionality. If no debugging functionality is available, this statement has no effect.</dd> - <dt>{{jsxref("Statements/export", "export")}}</dt> - <dd>Used to export functions to make them available for imports in external modules, another scripts.</dd> - <dt>{{jsxref("Statements/import", "import")}}</dt> - <dd>Used to import functions exported from an external module, another script.</dd> - <dt>{{jsxref("Statements/label", "label")}}</dt> - <dd>Provides a statement with an identifier that you can refer to using a <code>break</code> or <code>continue</code> statement.</dd> -</dl> - -<dl> - <dt>{{deprecated_inline}} {{jsxref("Statements/with", "with")}}</dt> - <dd>Extends the scope chain for a statement.</dd> -</dl> - -<h2 id="Specifications">Specifications</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('ES1', '#sec-12', 'Statements')}}</td> - <td>{{Spec2('ES1')}}</td> - <td>Initial definition</td> - </tr> - <tr> - <td>{{SpecName('ES3', '#sec-12', 'Statements')}}</td> - <td>{{Spec2('ES3')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES5.1', '#sec-12', 'Statements')}}</td> - <td>{{Spec2('ES5.1')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('ES6', '#sec-ecmascript-language-statements-and-declarations', 'ECMAScript Language: Statements and Declarations')}}</td> - <td>{{Spec2('ES6')}}</td> - <td>New: function*, let, for...of, yield, class</td> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-ecmascript-language-statements-and-declarations', 'ECMAScript Language: Statements and Declarations')}}</td> - <td>{{Spec2('ESDraft')}}</td> - <td> </td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - - - -<p>{{Compat("javascript.statements")}}</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators">Operators</a></li> -</ul> |
