Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
255 B
5
Indexable
num = 5;
let counter = (function test(num) {
    return function(x=1) {
        for (let i = 0; i < x; i++) { 
            ++num
        }
        return num;
       
    }
})(num);
console.log(counter());
console.log(counter(2));
console.log(counter(3));