![](/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.