x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript 函数</h1>
<p>在此示例中,person 的 fulllName 方法在 person1 上<b>应用</b></p>
<p id="demo"></p>
<script>
var person = {
  fullName: function(city, country) {
    return this.firstName + " " + this.lastName + "," + city + "," + country;
  }
}
var person1 = {
  firstName:"Bill",
  lastName: "Gates"
}
var x = person.fullName.apply(person1, ["Seatle", "USA"]); 
document.getElementById("demo").innerHTML = x; 
</script>
</body>
</html>