In this article http://howtonode.org/why-use-closure an example is given :
function greeter(name, age) {
var message = name + ", who is " + age + " years old, says hi!";
return function greet() {
console.log(message);
};
}
// Generate the closure
var bobGreeter = greeter("Bob", 47);
// Use the closure
bobGreeter();
Why would it be more worth than
function greeter(name, age) {
var message = name + ", who is " + age + " years old, says hi!";
console.log(message);
}
greeter("Bob", 47);
which is much shorter and does apparently the same thing ? Or it doesn't ?
Update 2: could it be usefull somehow for this case Solving ugly syntax for getter in js