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