title: Why not just check this instanceof fBound in the bind method polyfill?
body: <p>This is an older version of <code>bind</code> method polyfill from MDN:</p>
  <pre class="lang-js prettyprint-override"><code>if (!Function.prototype.bind) {
      Function.prototype.bind = function(oThis) {
          if (typeof this !== &quot;function&quot;) {
              // closest thing possible to the ECMAScript 5
              // internal IsCallable function
              throw new TypeError( &quot;Function.prototype.bind - what &quot; +
                  &quot;is trying to be bound is not callable&quot;
              );
          }
  
          var aArgs = Array.prototype.slice.call( arguments, 1 ),
              fToBind = this,
              fNOP = function(){},
              fBound = function(){
                  return fToBind.apply(
                      (
                          this instanceof fNOP &amp;&amp;
                          oThis ? this : oThis
                      ),
                      aArgs.concat( Array.prototype.slice.call( arguments ) )
                  );
              }
          ;
  
          fNOP.prototype = this.prototype;
          fBound.prototype = new fNOP();
  
          return fBound;
      };
  }
  </code></pre>
  <p>And I'm confused with <code>this instanceof fNOP</code> here. I know sometimes we may call the fBound return by <code>bind</code> method as a constructor function. Like this:</p>
  <pre class="lang-js prettyprint-override"><code>const fn2 = fn1.bind()
  new fn2()
  </code></pre>
  <p>So I think the purpose of <code>this instanceof fNOP</code> is to help judge how we call the function return by <code>bind</code> method and do something relatively. But why no just check <code>this instanceof fBound</code> here? If the fBound is called as a constructor function, then <code>this</code> must be an instance of fBound, right?</p>
  <p><strong>PS:</strong> The latest version of bind polyfill has turned the <code>this instanceof fNOP</code> check into the <code>fNOP.prototype.isPrototypeOf(this)</code> check, but I think the purpose is the same. Anyway, it still check <code>fNOP</code> instead of <code>fBound</code>, which I can't quite understand.</p>