Javascript parse/evaluation order?
- by Breck Fresen
This is probably a nub question, but I don't understand why this works:
<script type="text/javascript">
alert(foo);
function foo() { }
</script>
This alerts "function foo() { }", but I expected the alert to be evaluated before the function foo was defined. Can someone explain what I don't understand about parse/evaluation order or point me to a resource that does?
Thanks in advance,
-- Breck