maryasov
7/31/2019 - 5:36 AM

es6 reduce

out:

117
-buffalo-antilope-gazelle-deer-goat
  myArray.reduce((mapped, item) => (
    mapped += item.number;
  ), 0);
  
  myArray.reduce((mapped, item) => (
    mapped += `-${item.name}`;
  ), "");