javascript reduce slice array code example
Example 1: 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);
Example 2: syntax of reduce in js
[1,2,3,4,5].reduce((acc, current)=>acc+current, 0)