I'm getting an the "prefer-arrow-method" eslint error thrown with the reduce function below. I know it's because the function is anonymous but how would I rewrite the reduce method to resolve this error?
const nameBrand =
names.brand().reduce(function (sum, name) {
sum[name] = name;
return sum;
}, {});
const nameBrand = names.brand().reduce((sum, name) => {
sum[name] = name;
return sum;
}, {});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.