function functionCall(data, option) { if (someCondition) { var dynamicFunc = function1; var args = [data, option, 1]; } else { var dynamicFunc = function2; var args = [data, option, 2]; } var value = dynamicFunc.apply(dynamicFunc, args); // processing value }