The code works, because JavaScript implicitly hoists variable declarations to the top of the enclosing scope. But it does look strange, so I'll move it.