Skip to content

Instantly share code, notes, and snippets.

@bobwei
Created November 23, 2018 03:41
Show Gist options
  • Save bobwei/4c76f4bdfcfe834b925c61532db90582 to your computer and use it in GitHub Desktop.
Save bobwei/4c76f4bdfcfe834b925c61532db90582 to your computer and use it in GitHub Desktop.
bind.js
function test() {
return this.name;
}
// please implement your bind function here.
Function.prototype.bindFunction = function(context) {
};
const context = {
name: 'Hello',
};
const fn = test.bindFunction(context);
const result = fn();
console.log('expect result', result, 'toBeEqual', 'Hello');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment