Factory & Constructor Functions
What's the issue with this factory function implementation?
const createPerson = (name, age) => {
const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1);
return {
name: capitalize(name),
age,
greet() {
console.log(`Hello, I'm ${this.name}`);
}
};
};