Skip to content Skip to sidebar Skip to footer

Function With Eval Won't Make It Through Minification

Here is my weird function that let my users create their own javascript code function evalThisFunction(functionBody){ var func; eval('func = ' + functionBody);

Solution 1:

Yes, use the Function constructor:

functionevalThisFunction(functionBody){        
     returnFunction(functionBody);
}

Alternatively, you can swap out the above code entirely for Function , it seems to do what you want anyway. eval has scoping issues.

Post a Comment for "Function With Eval Won't Make It Through Minification"