代码示例:(标识:js_function_bind_borrow)
<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Function bind()</h1>

<p>此例创建 2 个对象(person 和 member)。</p>
<p>member 对象借用了 person 的 fullname 方法:</p> 

<p id="demo"></p>

<script>
const person = {
  firstName:"Bill",
  lastName: "Gates",
  fullName: function() {
    return this.firstName + " " + this.lastName;
  }
}

const member = {
  firstName:"Steve",
  lastName: "Jobs",
}

let fullName = person.fullName.bind(member);

document.getElementById("demo").innerHTML = fullName();
</script>

</body>
</html>
运行结果: