Javascript syntax oddity

Javascript syntax oddity


I didn't expect this to work (with my 'compiler' hat on) but it does:
var clickFunction = function() { $inner.doSomething() };
$("div")
.append("<div id=inner>bla</div>")
.click(clickFunction);
var $inner = $div.find("#inner");
I was expecting an error for $inner to be undefined when the
javascript parsed the first line, but the browser script engines seems
quite happy with this sort of super-late declaration.