This code always works, even in different browsers:
function fooCheck() { alert(internalFoo()); // We are using internalFoo() here... return internalFoo
For the same reason the following will always put foo in the global namespace:
foo
if (test condition) { var foo; }