error Expected an assignment or function call and instead saw an expression

error Expected an assignment or function call and instead saw an expression

Why does recursion always report errors and cannot run?

 

Now there are two ways to deal with it

1. Add a return before the expression

res.data.forEach(item =>
          item.attr_vals.length === 0 ?[] : item.attr_vals.split(' ')
        )

2. Remove curly braces  

 res.data.forEach(item => {
          returnitem.attr_vals.length === 0 ?[] : item.attr_vals.split(' ')
            }
        )

 

Read More: