leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
2666.js (232B)
0 /**
1 * @param {Function} fn
2 * @return {Function}
3 */
5 var once = function(fn) {
6 var called = false;
7 return function(...args){
8 if(called) return undefined;
9 called = true;
10 return fn(...args);
11 }
12 };