From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/nl/glossary/hoisting/index.html | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 files/nl/glossary/hoisting/index.html (limited to 'files/nl/glossary/hoisting') diff --git a/files/nl/glossary/hoisting/index.html b/files/nl/glossary/hoisting/index.html new file mode 100644 index 0000000000..82aca448f7 --- /dev/null +++ b/files/nl/glossary/hoisting/index.html @@ -0,0 +1,41 @@ +--- +title: Hoisting +slug: Glossary/Hoisting +tags: + - CodingScripting + - Glossary + - JavaScript +translation_of: Glossary/Hoisting +--- +

{{Glossary("Function", "Functies")}} en {{Glossary("Variable", "variabelen")}} zijn hoisted (letterlijk: "getakeld" of "omhoog gehesen") in {{Glossary("JavaScript")}}. Hoisting is het gedrag in JavaScript waarbij declaraties naar het begin van een {{Glossary("scope")}} verplaatst worden (globale scope of de scope van de huidige functie).

+ +

Dit betekent dat men een functie of een variabele kan gebruiken vooraleer ze gedeclareerd is. Met andere woorden: een functie of een variabele kan geclareerd worden nadat ze al is gebruikt.

+ +

Leer meer

+ +

Technisch voorbeeld

+ +

Variabelen:

+ +
foo = 2
+var foo;
+
+// wordt impliciet begrepen als:
+
+var foo;
+foo = 2;
+ +

Functies:

+ +
hoisted(); // logt "foo"
+
+function hoisted() {
+  console.log("foo");
+}
+ +

Technische referenties

+ + -- cgit v1.2.3-54-g00ecf