summaryrefslogtreecommitdiffhomepage
path: root/javascript.html.markdown
diff options
context:
space:
mode:
authorcubuspl42 <kubusiowski@o2.pl>2013-12-14 14:41:07 +0100
committercubuspl42 <kubusiowski@o2.pl>2013-12-14 14:41:07 +0100
commit432eb6f53df3a78dd5d3f564a1bbaa551a970732 (patch)
treec164d3b2ffefa49df203661b4c7284c2a954b957 /javascript.html.markdown
parent48d9eecbfd6b53895c719c4903850cc8a561014c (diff)
Note about how declaring functions affects scope.
Diffstat (limited to 'javascript.html.markdown')
-rw-r--r--javascript.html.markdown2
1 files changed, 2 insertions, 0 deletions
diff --git a/javascript.html.markdown b/javascript.html.markdown
index 348cbff5..5f0b7951 100644
--- a/javascript.html.markdown
+++ b/javascript.html.markdown
@@ -271,6 +271,8 @@ permanent; // = 10
// outer function's variables, even after the outer function exits.
function sayHelloInFiveSeconds(name){
var prompt = "Hello, " + name + "!";
+ // Inner functions are put in the local scope local by default, as if they
+ // were declared with 'var'.
function inner(){
alert(prompt);
}