Possible Duplicate:
How can I execute Javascript stored as a string?
Let us suppose this:
var a = 10;
var b = 20;
var exp = "a+b";
var result = ?;
Change the above expression which is string to give result in integer. Variable a is 10. Variable b is 20. Variable exp is a string containing the expression. Change that string expression to add variable a and variable b and store it in Variable result.
How can I do that with Javascript?