reduce javascript with string code example
Example 1: javascript sum of array
const sum = arr => arr.reduce((a, b) => a + b, 0);
Example 2: js reduce a array of straing
var authors = [{name: 'some author'},{name: 'another author'},{name: 'last author'}]
var authorString = authors.map(function(author){
return author.name;
}).join(",");
console.log(authorString);