javascript - Call a function with 'arguments' as separate arguments -


I try to pass the logic variable of an different function I am trying to do this: I have tried to:

  function call_function (func) {func (logic); }   

However, call_function (some functions, 123, 456) actually call some functions ([someFunction, 123, 456]) . In spite of this, the function itself is being passed, it is passed as a argument that is an object / array-like thing, but I want to call this code as the code in the SomeFunction (123, 456) .

I have also tried: func (Array.prototype.slice.call (Arguments, 1)) to remove the function (the first argument), but obviously it is actually a Array, that is, it gives the array as the first argument on the function.

How can I code call_function so that in the code like call_function (someFunction, 123, 456) result some functions (123, 456) being called? Apply

To call a function with the array as argument, / Code> function.

Comments