Iterate over employee name using array#map
and generate the full name.
let employeeNames = [ { firstName: "Collin", lastName: "Sexton" }, { firstName: "Darius", lastName: "Garland" } ],
output = employeeNames.map(o => ({...o, fullName: `${o.firstName} ${o.lastName}`}))
console.log(output);
.as-console-wrapper { max-height: 100% !important; top: 0; }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…