What is the impact on running-time and memory defining a clousre vs. global-scope function?
function a(){
//functions (option A)
}
//functions(option B
Performance
A very tiny benchmark case:
#1 inner function: http://jsfiddle.net/bMHgc/
#2 function outside: http://jsfiddle.net/sAVZn/
At my machine: (5000 * 1000 times)
#1 - 700ms
#2 - 80ms
Memory
They are almost the same ...
I would recommend option A, if possible, since it can make your code cleaner.