let newArr=[ {"name":"28","value":4}, {"name":"55","value":7}, {"name":"55","value":1} ] let ageNumList=[] newArr.forEach(el=>{ const result = ageNumList.findIndex(ol=>{return el.name === ol.name}) if(result!== -1){ ageNumList[result].value = newArr[result].value + el.value }else{ ageNumList.push(el) } }) console.log('ageNumList',ageNumList)
上面是“js数组name相同的元素value值相加”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_119.html
workflows工作流
水中一台精致而破旧的老式电视鱼缸ComfyUI工作流
一个可爱的人形小机器人和一只蜗牛在森林
一座千年九尾白狐玉雕ComfyUI工作流
一个外国人在吹奏萨克斯ComfyUI工作流
3D圆形玉雕图案comfyui工作流
庭院,彩色玫瑰,云雾笼罩comfyui工作流
一个闪闪发光的金属球ComfyUI工作流
一只外星甲壳虫子ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!