From 432eb6f53df3a78dd5d3f564a1bbaa551a970732 Mon Sep 17 00:00:00 2001 From: cubuspl42 Date: Sat, 14 Dec 2013 14:41:07 +0100 Subject: Note about how declaring functions affects scope. --- javascript.html.markdown | 2 ++ 1 file changed, 2 insertions(+) (limited to 'javascript.html.markdown') 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); } -- cgit v1.2.3