多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ // var n = 0, // fn = function () { // this.n *= 2; // n++; // return function (m) { // n += ++m; // console.log(n); // } // }; // var f = fn(2); // f(3);//5 // fn(3)(4);//16 // f(4);//21 // console.log(n); //21 ~~~ ![](https://img.kancloud.cn/d5/c5/d5c57c90e3958929859061d35c101e87_1798x692.png) ~~~ let i = 2; let fn = function (n) { i *= 2; return function (m) { i -= (n--) + (++m); console.log(i); } }; let f = fn(1); f(2); fn(3)(4); f(5); console.log(i); ~~~ ![](https://img.kancloud.cn/e2/d7/e2d71ad461ffe44a9576d7760270adef_2142x834.png)