Concatenate Strings from Objects
SoftServeCiklum
Given an array of objects, where each object has a name property, write a function that returns a single string with all names concatenated, separated by commas and a space.
Example:
Input: [{ name: "Alice" }, { name: "Bob" }]
Output: "Alice, Bob"
Examples:
Input 1:
{"arr":[{"name":"Alice"},{"name":"Bob"},{"name":"Charlie"}]}Output 1:
"Alice, Bob, Charlie"Input 2:
{"arr":[{"name":"John"}]}Output 2:
"John"Loading editor...
Run your code to see results
Click the Run button above