Hello, I’m new to forum so if there is any similar topic with mine. Sorry but I couldn’t find it. My question is when i create factory function with using this in my fullName
method it works good. But whenever I delete this key it still works, why?
function myfactory(name,lastname) {
return {
name,
lastname,
get fullName() {
return name + " " + lastname;
}
}
}
const fudayl = myfactory('fudayl','cavus')
console.log(fudayl.fullName) // fudayl cavus
const test = myfactory('Name','LastName')
console.log(test.fullName) // Name LastName