I am coding an object. I want that the object contains the first name the last name and combined with this two values a full name. In the code below I tried to implement but only the object as such will logged into the console.
const user = {
firstName(firstName) {
return firstName;
},
lastName(lastName) {
return lastName;
},
get fullName() {
return `${this.firstName} ${this.lastName}`;
}
}
console.log(`${user.firstName("Andrew")} ${user.lastName("Tate")}`);
console.log(user.fullName);