Oct 22

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']();

Continue reading »

Tagged with:
preload preload preload