From 942fa421f0d1a715f6e88a08cfc9f3b19ed0ccbb Mon Sep 17 00:00:00 2001 From: Exarchiasghost Date: Thu, 21 Jul 2016 16:35:14 +0200 Subject: [PATCH] Update Basics scope README.md --- Basic_Concepts/Scope/README.md | 38 +++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/Basic_Concepts/Scope/README.md b/Basic_Concepts/Scope/README.md index bd314ba..cdc9999 100644 --- a/Basic_Concepts/Scope/README.md +++ b/Basic_Concepts/Scope/README.md @@ -2,25 +2,39 @@ # Scope -This MD file serves as example/template. +According [Wikipedia](https://en.wikipedia.org/wiki/Variable_%28computer_science%29#Scope_and_extent): +*"Scope is an important part of the name resolution of a variable. Most languages define a specific scope for each variable (as well as any other named entity), which may differ within a given program. The scope of a variable is the portion of the program code for which the variable's name has meaning and for which the variable is said to be "visible"."* -It will be filled up soon. -(for Bucky to fill up) +# Course Documentation -# Course Documentation +## Scope and Variables + +Variables are the names of the places that some value is stored and the most typical syntax to create them is: + + var variablesname = valueofvariable; + + +and after the creation we are typically changing the value with this syntax: -(this for me to fill up with every element + variablesname = newvalueforthevariable; -that you use in lessons. syntax + +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: + + console.log(variablesname) -explaination and links for more) + +Scope on the other hand is about variable's inheritance, (with other words how accessible can a variable be). Typically it has two levels: -## Element to explain + - **Global** External variable when every function can access it. + - **Local** Internal variable when only the function that -(for example console.log) + +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