var Counter = function(){
var i = 0;
return function(){
return i++;
};
};
var counter = Counter();
console.log(counter());
console.log(counter());
console.log(counter());
console.log(counter());
var counter = (function() {
var i = 0;
return function(start) {
i = ++start || i;
return i++;
};
})();
console.warn(counter());
console.warn(counter());
console.warn(counter(99));
console.warn(counter());
console.warn(counter(199));
console.warn(counter());