Skip to content

Commit ce9a9c7

Browse files
committed
Basics Closure README.md
The things will get interesting on the near future when i will start to combine the knowledge between documentations.
1 parent 7b9203c commit ce9a9c7

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

Basic_Concepts/Closures/README.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
![](http://i.imgur.com/BgUMUGU.png)
23

34
## Closures
@@ -7,12 +8,31 @@ enclosing scope). In other words, these functions 'remember' the environment in
78

89
# Course Documentation
910

10-
(this for me to fill up with every element that you use in lessons. syntax explaination and links for more)
11+
## Scope and Variables
12+
13+
Variables are the names of the places that some value is stored and the most typical syntax to create them is:
1114

12-
## Element to explain
15+
var variablesname = valueofvariable;
16+
17+
18+
and after the creation we are typically changing the value with this syntax:
19+
20+
variablesname = newvalueforthevariable;
21+
22+
23+
And if it is not clear the easiest thing in the world is to access the variable just by writing the variable there where we will use its value:
1324

14-
(for example console.log)
25+
console.log(variablesname)
26+
27+
28+
Scope on the other hand is about variable's inheritance, (with other words how accessible can a variable be). Typically it has two levels:
29+
30+
- **Global** External variable when every function can access it.
31+
- **Local** Internal variable when only the function that
32+
33+
34+
In our example we used things like this. to manipulate our variables in a special way. This is called a JavaScript closure. It makes it possible for a function to have "private" variables or use private variables in a special way. (see Objected Oriented Programming or Classes.)
35+
36+
For more information please check the [W3schools Javascript closures' documentation page](http://www.w3schools.com/js/js_function_closures.asp).
1537

16-
***Links***
17-
- Wikipedia
18-
- Anotherlink,com
38+
> Written with [StackEdit](https://stackedit.io/).

0 commit comments

Comments
 (0)