js给一段话,遇到的第一个括号处加上换行符
list.forEach((item,index0)=>{
const productName = item.name;
const index = productName.indexOf('(');
if (index == -1) {
return productName;
}
const before = productName.slice(0, index);
const after = productName.slice(index);
item.name=before + '\n' + after;
});