design patterns - javascript polymorphism refactoring -
i have object maps properties functions, this: var objfunctions = { prop1: func1, prop2: func2, prop3: func3, }; now, need valid prop name call adequate function, example var callfuncprop = 'prop1' objfunctions[callfuncprop]('value1'); this works fine, however, let's new function came up, , needs additional arguments. dynamically calling function additional arguments means other functions receive them objfunctions[callfuncprop]('value1', 'value2', 'value3'); // calls func1 defined 1 parameter this works, have problem kind of design. how refactor code can still dynamically call functions pass additional arguments functions expects them ? avoid switch statement...