有一个数组(如下)长度不固定letarr=[{name:1,img:'http://img1.png'},{name:2,img:'http://img2.png'},{name:3,img:'http://img3.png'},{name:4,img:'http://img4.png'},{name:5,img:'http://img5.png'},{name:2,img:'http://img6.png'},......]需要过滤name值相等的相同项,然后把(需要过滤的这项的img替换到)不需要过滤且name值相等的img上如:letarr=[{name:1,img:'http://img1.png'},{name:2,img:'http://img6.png'},{name:3,img:'http://img3.png'},{name:4,img:'http://img4.png'},{name:5,img:'http://img5.png'},//{name:2,img:'http://img6.png'},这一项过滤删除掉。这项的img值需要赋值给(不需要过滤且name值相等的img上)......]
Qyouu
相关分类