× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

A shorthand for Function.prototype.call.call?

Utkarsh Upadhyay
Jun 23, 2015
<p>If you want to do that, then consider this (if you have an ES5 compliant interpreter):</p> <pre><code>var call = Function.prototype.call.bind(Function.prototype.call) </code></pre> <p>The <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind" rel="nofollow">bind</a> function makes sure that the <em>context</em> (the <code>this</code> variable) while making the function call is <code>Function.prototype.call</code> instead of <code>undefined</code>, as you see in your case.</p> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/30889321/A%20shorthand%20for%20Function.prototype.call.call?/30889362">Stack Overflow</a>.</p>
comments powered by Disqus