This post was written in 2009, please read this stack on why eval is always a bad idea:
https://stackoverflow.com/questions/13167403/is-javascript-eval-so-dangerous</strong>
Usually when I need to call a JavaScript function using a string I use:
function myUsefulFunction() { //useful code } var foo = 'myUsefulFunction();'; eval(foo);
However a more elegant approach would be to use:
function myUsefulFunction() { //useful code } this['myUsefulFunction']();
Recent Comments