Your code:
function createFunctionArray(){
var result = new Array();
for(i=0;i<10;++i){
result[i] = function(){
var now = i;
return now;
};
}
return result
}
When you call this function. You loop i from 0 to 9 and push those functions you created into the array. But, those functions are never run yet.
When the loop ended when i = 10, you have an array of functions that you created but never called. So now.. when you call any one of the funcions by result[.. say 4]. The function will set var now = i, which is currently 10, and return that value.
This is way you always get 10.