Fungsi pabrik dalam JavaScript

let john = {
    firstName: 'John',
    lastName: 'Doe',
    getFullName() {
        return this.firstName + ' ' + this.lastName;
    }
};

console.log(john.getFullName());
Code language: JavaScript (javascript)
Talented Tern