I have two array of objects:
var a = [{id:456, name:'sojuz'},
{id:751, name:'sputnik'},
{id:56, name:'arianne'}]
var b = [{id:751, weight:5800},
{id:456, weight:2659},
{id:56, weight:6700}]
Using underscorejs how to extend array a into new array c adding weight property from array b where the id property is the same:
var c = [{id:456, name:'sojuz', weight:2659},
{id:751, name:'sputnik', weight:5800},
{id:56, name:'arianne', weight:6700}]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…