From ce9a9c7ab8eae27febcf18c9c4433c782c42865d Mon Sep 17 00:00:00 2001 From: Exarchiasghost Date: Mon, 11 Jul 2016 17:15:02 +0200 Subject: [PATCH] Basics Closure README.md The things will get interesting on the near future when i will start to combine the knowledge between documentations. --- Basic_Concepts/Closures/README.md | 32 +++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/Basic_Concepts/Closures/README.md b/Basic_Concepts/Closures/README.md index de2afa0..4dd6bd7 100644 --- a/Basic_Concepts/Closures/README.md +++ b/Basic_Concepts/Closures/README.md @@ -1,3 +1,4 @@ + ![](http://i.imgur.com/BgUMUGU.png) ## Closures @@ -7,12 +8,31 @@ enclosing scope). In other words, these functions 'remember' the environment in # Course Documentation -(this for me to fill up with every element that you use in lessons. syntax explaination and links for more) +## Scope and Variables + +Variables are the names of the places that some value is stored and the most typical syntax to create them is: -## Element to explain + var variablesname = valueofvariable; + + +and after the creation we are typically changing the value with this syntax: + + variablesname = newvalueforthevariable; + + +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: -(for example console.log) + console.log(variablesname) + + +Scope on the other hand is about variable's inheritance, (with other words how accessible can a variable be). Typically it has two levels: + + - **Global** External variable when every function can access it. + - **Local** Internal variable when only the function that + + +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.) + +For more information please check the [W3schools Javascript closures' documentation page](http://www.w3schools.com/js/js_function_closures.asp). -***Links*** - - Wikipedia - - Anotherlink,com \ No newline at end of file +> Written with [StackEdit](https://stackedit.io/). \ No newline at end of file