I basically want to convert a string containing code like this -
var code = "function Solve(args) { // do stuff and return value};";
into an executable function which you can pass arguments. 
   When I use it with eval(code + "Solve(args);"); It gives me no errors but the results are not as expected. I also tried: 
var fu = eval(code);
var result = fu(args);
fu stays undefined. Am I doing something wrong or is there a better way to do this.
// do stuff and return valuemight be helpful?