![](/img/trans.png)
[英]How to convert for of loop into a for loop to solve the ESLint error
[英]Eslint error when using the for in loop how to restructure
我得到iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations
iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations
錯誤
const errors = {};
for (const i of err.inner) {
errors[i.path] = i.message;
}
如何重組代碼以消除此錯誤謝謝
嘗試這個:
let errors = {};
err.inner.forEach(item => {
errors[item.path] = item.message;
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.