A loop within a function that is also in a loop gives an error

[亡魂溺海] 提交于 2019-12-12 04:42:17

问题


How can i get this function out of the i iteration loop, since jshint gives me an error.

 for (i = 0; i < portfolios.length; i++) {
            return function () {
                for (h = 0; h < markers.length; h++) {
                    markers[h].infobox.close();
                }
                markers[i].infobox.open(map, this);
            };
        })(marker, i));
    }
}

thanks!

来源:https://stackoverflow.com/questions/21742651/a-loop-within-a-function-that-is-also-in-a-loop-gives-an-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!