Say I\'ve got a Javascript string like the following
var fnStr = \"function(){blah1;blah2;blah3; }\" ;
(This may be from an expression the
You can do this:
//in your case: eval("var fn = " + fnStr); eval("var fn = function(){ blah1;blah2;blah3; }"); fn();
Not sure how to get it much simpler, sometimes there's no (better) way around eval(). Here's a quick example of this in action.
eval()