1
0
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:
Nami-Doc 2013-12-14 05:49:30 -08:00
commit 6f194db755

View File

@ -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);
}