aboutsummaryrefslogblamecommitdiffstats
path: root/2620/main.js
blob: da3ecbe0a48d8b7cecdedc669ba9d6928f2c080f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                  
#!/usr/bin/env node
"use strict";

/**
 * @param {number} n
 * @return {Function} counter
 */
var createCounter = function (n) {
  var count = n;
  return function () {
    return count++;
  };
};

const counter = createCounter(10);
console.log(counter()); // 10
console.log(counter()); // 11
console.log(counter()); // 12