completion factory function meets the following requirements
saves the passed parameter name to a private variable
function returns an object, and the object has a privileged method getName, to return the value of the object"s private variable name
as follows:
var person = createPerson("Jero");
console.log("person.name); //underfind
console.log("person.getName()); //Jero
I just started to learn the concept of closure, but I don"t quite understand the concept of privileged methods, so how can this be implemented to match the output of the two console.log above?
Thank you!