Js 实现每次调用一个函数自动加1
var getId = (function () { // "use strict"; var i = 0; return function () { return ++i; }; })(); console.log(getId()); //1 console.log(getId()); //2
原文链接: https://blog.csdn.net/weixin_43971228/article/details/89146656?ivk_sa=1024320u