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