create nodejs new object
const personFactory = (firstName, lastName, email) => {
return {
firstName: firstName,
lastName: lastName,
email: email,
info() {
return `${this.firstName} ${this.lastName}, ${this.email}`;
}
};
};
let person = personFactory('John', 'Doe', '[email protected]');
console.log(person.info());