Javascript calling inner function from outside using closure
by Parker
JavaScript
var plus = null;
add();
plus();
plus();
plus();
alert(plus());
function add() {
var counter = 0;
plus = (function(counter) {
return function() {counter += 1;return counter;};
})(counter);
plus();
}