summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNami-Doc <vendethiel@hotmail.fr>2013-12-14 05:49:30 -0800
committerNami-Doc <vendethiel@hotmail.fr>2013-12-14 05:49:30 -0800
commit6f194db75559eef10ee84e691a5bfdc3914e2ad5 (patch)
tree9e7a4e6329eb1e38fc99362a352099f89b4c37e4
parent48d9eecbfd6b53895c719c4903850cc8a561014c (diff)
parenteafeb3b4611d705f0c83bd652089bab364a8b2db (diff)
Merge pull request #450 from cubuspl42/master
[JavaScript] Note about how declaring functions affects scope.
-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..4584a28c 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 by default, as if they were
+ // declared with 'var'.
function inner(){
alert(prompt);
}