let lessons = [ { category:'css', title:'层叠样式' }, { category:'html', title:'超文本标记语言' }, { category:'javascript', title:'编程语言' }, ]; let res = lessons.reduce((obj,cur,index)=>{ obj[`${cur['category']}-${index+1}`]=cur; return obj; },{}); console.log(JSON.stringify(res,null,2));