Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var counter = (function () {
- var current = 0;
- return function () {
- current++;
- return current;
- }
- })();
- console.log(counter()); // 1
- console.log(counter()); // 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement