mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-03-16 04:10:01 +01:00
Merge pull request #450 from cubuspl42/master
[JavaScript] Note about how declaring functions affects scope.
This commit is contained in:
commit
6f194db755
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user