javascript - ESLint Error: prefer-arrow-callback on the reduce method? -


i'm getting "prefer-arrow-method" eslint error thrown reduce function below. know it's because function anonymous how rewrite reduce method resolve 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; }, {}); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -