bind implementation

by Vladymyr Shevchuk

JavaScript

function bind (obj, args) {
 /* your implementation */
}

const obj = {name: 'Batman'};
const getName = function () { return this.name };

console.assert(typeof bind(obj) === 'function', 'Should return function');
console.assert(bind(obj) && bind(obj)() === 'Batman', 'Should call function in object context');