Answers for "Reduce array to a single string"

1

Reduce array to a single string

var authors = [{name: 'some author'},{name: 'another author'},{name: 'last author'}]
var authorString = authors.map(function(author){
    return author.name;
}).join(",");
console.log(authorString);
Posted by: Guest on December-02-2020
0

Reduce array to a single string

var authors = ['some author', 'another author', 'last author'];
var authorString = authors.join(",");
console.log(authorString);
Posted by: Guest on December-02-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language