Patterns for dealing with variadic arguments in JavaScript <p>I usually do something like the following when dealing with variadic arguments in JavaScript:</p> <pre><code>var f = function() { var args = Array.prototype.slice.call(arguments, 0); // ... return something; }; </code></pre> <p>But what about doing instead:</p> <pre><code>var f = function() { return (function(self, args) { // ... return something; }(this, Array.prototype.slice.call(arguments, 0))); }; </code></pre> <p>I couldn't readily find anything addressing the pattern above, so I decided to post it here. Before I start experimenting with it, I would like to know if <strong>there are any flaws or risks</strong> I could be missing when using the rather unusual patterns described above.</p>