GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing javascript.info — Does a function pickup latest changes? back to the lesson Does a function pickup latest changes?importance: 5 The function sayHi uses an external variable name. When the function runs, which value is it going to use?
Such situations are common both in browser and server-side development. A function may be scheduled to execute later than it is created, for instance after a user action or a network request. So, the question is: does it pick up the latest changes? The answer is: Pete. A function gets outer variables as they are now, it uses the most recent values. Old variable values are not saved anywhere. When a function wants a variable, it takes the current value from its own Lexical Environment or the outer one. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |