// returns an object with closed over properties.functionPerson(name, age) {// ๐ธ private properties// โข `name`, `age` are treated as private properties.// โญ๏ธ the object to be returned (with exposed methods)constobj= { sayHi };// -------- define getter/setter/method --------// ๐ธ obj.name (getter/setter)Object.defineProperty(obj,'name', {get() { return name },set(value) { name = value }, });// ๐ธ obj.sayHi (exposed method)functionsayHi() {console.log(`Hi, my name is ${name}, I'm ${age} years old.`); }return obj;}// instancesconstjoe=Person('Joe',10);constjane=Person('Jane',8);joe.name ='Superman'; // "setter" calledjoe.sayHi(); // Hi, my name is Superman, I'm 10 years old.jane.sayHi(); // Hi, my name is Jane, I'm 8 years old.