Why does shadowed variable evaluate to undefined when defined in outside scope?
问题 Consider the following piece of code: <html><head></head> <body> <script type=\"text/javascript\"> var outside_scope = \"outside scope\"; function f1() { alert(outside_scope) ; } f1(); </script> </body> </html> The output for this code is that the alert box displays the message \"outside scope\". But, if I slightly modify the code as: <html><head></head> <body> <script type=\"text/javascript\"> var outside_scope = \"outside scope\"; function f1() { alert(outside_scope) ; var outside_scope = \