JSFiddle - React, Tailwind, and code Playground

by Vladymyr Shevchuk

JavaScript

// bind polyfill

function bind (obj) {
  function f() {
   
  }
  
  f.prototype = obj;
  
  return f;
}

Function.prototype.bind = bind;


const obj = {
  foo: 'Hello world'
};

function riba () {
  return this.foo;
}

const f = riba.bind(obj);
console.error(f());