start the function whose name is in the variable. For example:
var f_name = 'f_start';
And you need to run a function called f_start. Is this a doable task?
start the function whose name is in the variable. For example:
var f_name = 'f_start';
And you need to run a function called f_start. Is this a doable task?
function f_start(){ alert('UpS!'); } var f_name = 'f_start'; window[f_name](); // можно еще так, как показано ниже, НО не советую, т.к. **eval === evil** //eval(f_name)();
Source: https://ru.stackoverflow.com/questions/200656/
All Articles