I struggle to understand the advantages of the revealing module pattern. Take f.e. the following code:
var Person = function(name){
this.name = name;
var priv = 'secret';
}
var OtherPerson = function(name){
var name = name;
var priv = 'secret';
return({name: name});
}
duke = new Person('john');
dust = new OtherPerson('doe');
To my knowledge OtherPerson should be a classic revealing module as I found it in various resources in the web. So what is the difference between Person and OtherPerson?
I personally think that Person looks a lot cleaner and you can see your private and public variables more easily.