why does "a();function a(){}" work in javascript? but most of the other dynamic language do not

Possible Duplicate:
Ambiguous function declaration in Javascript

above does work in nodejs. I am wondering about the underlying difference of javascript and python/ruby handling this case.

Because in JavaScript, [[FunctionDeclaration]]s are hoisted (including initialization) to the top of the current lexical scope. So you can call them anywhere within the lexical scope (even "before" they're "defined").

Feel free to check the spec if you're interested in the exact process: http://es5.github.com/#x13