原型练习题

2021-02-02  本文已影响0人  may505
function Person(firstName, lastName) {
  this.firstName = firstName;
  this.lastName = lastName;
}

const member = new Person("Lydia", "Hallie");
Person.getFullName = function () {
  return `${this.firstName} ${this.lastName}`;
}

console.log(member.getFullName());

输出的结果为

解析

上一篇 下一篇

猜你喜欢

热点阅读