S2
jS
Learn
Create Your Own
Split Screen
Go to Live Site
Next Page
Even though the variable thing is created inside the function, it becomes a global.
<html> <script> do_something_else(); function do_something_else () { thing = 100; // oops, forgot to say var alert("do_something_else's thing=" + thing); } alert("global thing=" + thing); </script> </html>