I've done a bit of googling round but this particular problem is a little too similar to the "how do i evaluate function names from strings" so I'm having trouble finding a solution, I want to convert a string into a function so say i had something like:
for (var i = 0; i < someNumber ; i++) {
var foo = "function() { someObject.someOtherFunctionCall(" + i + ") }";
someArray[i] = foo;
}
how would I typecast foo so I could call
someArray[0]();
I need the value baked into the function, any ideas?
EDIT: I just substituted "value" for "i" apologies for the confusion
UPDATE:
Ok, I have accepted icktoofay answer because it works, to answer most of your questions and concerns; I have tried most of the methods suggested all of which either didn't pass the variable to the calling locations scope or required closures that persisted with the last functions variable value, unfortunately I don't have control over the rest of the code so I cant make modifications to the location the function eventually gets called.
This is probably a temporary solution; I'm aware of how ugly parsing strings for functions is. as far as browser compatibility goes this will only ever run in one environment, so I think we're pretty safe there.
Anyway, thanks again for the prompt answers and discussion.