I have 3 functions: ClientInfoA is doing something
ClientInfoB is doing something
SelectFunction2 Run is a function to determine which function needed to
run based on the value of the variable Method2Run. If the clientType
is A, it would run ClientInfoA function. If it is clientType B, it
would run the ClientInfoB function. Based on the value of Method2Run,
how would I run the function dynamically? I know that there are many
ways not to do this. But I am creating this for easy maintenance.
Thanks all
function ClientInfoA ()
{
....
....
}
function ClientInfoB ()
{
....
....
}
Function SelectFunction2 Run
var Method2Run
switch (clientType)
{
case "A": Method2Run = ClientInfoA
break;
case "B": Method2Run = ClientInfoB
break
}
// how do I run the Method2Run????
Run Method2Run (whatever the value)
ClientInfoB is doing something
SelectFunction2 Run is a function to determine which function needed to
run based on the value of the variable Method2Run. If the clientType
is A, it would run ClientInfoA function. If it is clientType B, it
would run the ClientInfoB function. Based on the value of Method2Run,
how would I run the function dynamically? I know that there are many
ways not to do this. But I am creating this for easy maintenance.
Thanks all
function ClientInfoA ()
{
....
....
}
function ClientInfoB ()
{
....
....
}
Function SelectFunction2 Run
var Method2Run
switch (clientType)
{
case "A": Method2Run = ClientInfoA
break;
case "B": Method2Run = ClientInfoB
break
}
// how do I run the Method2Run????
Run Method2Run (whatever the value)
Comment