How to 'forward' all-but-the-first-argument arguments of a function to another function?
javascript
Solution
Use `options[callback_name].apply(this, [].slice.call(arguments,1));`
`[].slice.call(arguments,1)` converts the arguments ('array-like') `Object` into a real `Array` containing all arguments but the first.
`[].slice.call` may also be written as `Array.prototype.slice.call`.
Problem
How do I forward the arguments from within a function to another function? I have this: ``` function SomeThing(options) { function callback(callback_name) { if(options[callback_name]) { // Desiring to call the callback with all arguments that this function // received, except for the first argument. options[callback_name].apply(this, arguments); } } callback('cb_one', 99, 100); } ``` What I get in the `a` argument is 'cb_one', but I want that it should be '99'. ``` var a = new SomeThing({ cb_one: function(a,b,c) { console.log(arguments); // => ["cb_one", 99, 100] console.log(a); // => cb_one console.log(b); // => 99 console.log(c); // => 100 } }); ``` How do I do this?