Bind (object) Function to an object.

Function.prototype.mybind=function(context){
  var that =this;
  return function(){
    return that.apply(context,arguments); }}var person ={
  age :18
}

function show(){
  console.log(this.age);
}
show.mybind(person)();
Copy the code