The*_*ure -3 javascript placeholder template-literals
我正在观看几年前关于学习 javascript 的 YouTube 视频,在视频中,除了在我的 VScode 上之外,代码似乎都可以工作。
这是代码,请让我知道我可能错过了什么:
function Person(firstName, lastName, dob) {
this.firstName = firstName;
this.lastName = lastName;
this.dob = new Date(dob);
this.dateBio = function() {
return `${this.dob.getFullYear}`
}
}
Person.prototype.fullName = function() {
return `${this.firstName} ${this.lastName}`
}
const person1 = new Person('James','Smith', '27 July 1967');
const person2 = new Person('Mary', 'Franklin', '5 November 1991')
console.log(person1.fullName)Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
56 次 |
| 最近记录: |