leetcode

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

2666.js (232B)


      1 /**
      2  * @param {Function} fn
      3  * @return {Function}
      4  */
      5 
      6 var once = function(fn) {
      7     var called = false;
      8     return function(...args){
      9         if(called) return undefined;
     10         called = true;
     11         return fn(...args);
     12     }
     13 };