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

<h1>JavaScript 函数</h1>

<p>此示例调用 person 的 fullName 方法,在 person2 上使用它:</p>

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

<script>
var person = {
  fullName: function() {
    return this.firstName + " " + this.lastName;
  }
}
var person1 = {
  firstName:"Bill",
  lastName: "Gates"
}
var person2 = {
  firstName:"Steve",
  lastName: "Jobs"
}
x = person.fullName.call(person2); 
document.getElementById("demo").innerHTML = x; 
</script>

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