diff options
author | cubuspl42 <kubusiowski@o2.pl> | 2013-12-14 14:41:07 +0100 |
---|---|---|
committer | cubuspl42 <kubusiowski@o2.pl> | 2013-12-14 14:41:07 +0100 |
commit | 432eb6f53df3a78dd5d3f564a1bbaa551a970732 (patch) | |
tree | c164d3b2ffefa49df203661b4c7284c2a954b957 | |
parent | 48d9eecbfd6b53895c719c4903850cc8a561014c (diff) |
Note about how declaring functions affects scope.
-rw-r--r-- | javascript.html.markdown | 2 |
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); } |