leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

2620.js (247B)


      1 /**
      2  * @param {number} n
      3  * @return {Function} counter
      4  */
      5 
      6 var createCounter = function(n) {
      7     return function() {
      8         return n++;
      9     };
     10 };
     11 
     12 var createCounter = function(n) {
     13     return () => n++;
     14 };
     15 
     16 var createCounter = (n) => () => n++;