Javascript: how to call function through variable and pass parameters [duplicate]

You can pass arguments to your function where you call window[aa]() like so:

function myfunction(text){
    alert(text);
} 

var aa= "myfunction";  
window[aa]("Hello Again..."); // just put any arguments in the parentheses.

Leave a Comment