Eslint警告我不要在for循环内部定义函数,我知道它是这样做的,因为它会为每个迭代定义该函数,这显然是不好的。但是,在我的例子中,我不知道如何重写代码,这样就不再需要这样做了。refreshProfiles(job, done) { for (let i = 0; i < 100; i++) { }).catch((err) =>
一段代码:return getFile.then(function _gotFile(file) { // getFile is a promise, resolvedfile; .catch(function() { // do other things on file, })
在上面的代码中,我使用promise cat