blob: da3ecbe0a48d8b7cecdedc669ba9d6928f2c080f (
plain) (
tree)
|
|
#!/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
|