title: Programming bind in js
body: <p>I have decided to recreate <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind" rel="nofollow noreferrer"><code>Function.prototype.bind</code></a> as <code>binding</code> in order to exercise. Woefully, I have encountered some problems and can't understand the reason of <code>undefined</code> output.
  Here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var alex = {
    firstname: "alex",
    surname: "surname",
  }
  let nameyourself = function() {
    console.log(`${this.firstname} ${this.surname}`);
  }
  
  
  Function.prototype.binding = function(smth, ...params) {
    smth.__proto__.bindedfunct = this;
  
    return smth.bindedfunct;
  
  }
  nameyourself.binding(alex)();</code></pre>
  </div>
  </div>
  </p>
  
  <p>Why is this happening?</p>